Skip to content

Commit

Permalink
Add as a parameter to initialize_hecuba the cqlsh command
Browse files Browse the repository at this point in the history
    * To support the execution with singularity in hosts where Cassandra is not installed (only for executions from enqueue_compss)
  • Loading branch information
yolandab committed Mar 12, 2024
1 parent c928921 commit bda3e9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cassandra4slurm/scripts/initialize_hecuba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ echo " CQLSH at ${1}"
#if [ "x$CQLSH_HOST" == "x" ] ; then
# export CQLSH_HOST=localhost
#fi

CQLSH_CMD=${2} #second parameter cqlsh location. To support execution with singularity (currently only supported for pycompss applications launched by enqueue_compss)
commands="CREATE KEYSPACE IF NOT EXISTS hecuba_locks WITH replication= {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS hecuba_locks.table_lock (table_name text, PRIMARY KEY (table_name)); TRUNCATE table hecuba_locks.table_lock;"

echo $commands | $CASS_HOME/bin/cqlsh ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }
echo $commands | ${CQLSH_CMD} ${1} || { echo "[ERROR]: Executing CQLSH [$commands] FAILED!!!" && exit; }

echo " Keyspace hecuba_locks created"
echo " Table table_lock created"
Expand All @@ -19,7 +19,7 @@ echo " Table table_lock created"
commands="CREATE KEYSPACE IF NOT EXISTS hecuba WITH replication= {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TYPE IF NOT EXISTS hecuba.q_meta( mem_filter text, from_point frozen<list<double>>, to_point frozen<list<double>>, precision float); CREATE TYPE IF NOT EXISTS hecuba.np_meta (flags int, elem_size int, partition_type tinyint, dims list<int>, strides list<int>, typekind text, byteorder text); CREATE TABLE IF NOT EXISTS hecuba.istorage (storage_id uuid, class_name text,name text, istorage_props map<text,text>, tokens list<frozen<tuple<bigint,bigint>>>, indexed_on list<text>, qbeast_random text, qbeast_meta frozen<q_meta>, numpy_meta frozen<np_meta>, saved_numpy_meta frozen<np_meta>, block_id int, base_numpy uuid, view_serialization blob, primary_keys list<frozen<tuple<text,text>>>, columns list<frozen<tuple<text,text>>>, PRIMARY KEY(storage_id));"


echo $commands | $CASS_HOME/bin/cqlsh ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }
echo $commands | ${CQLSH_CMD} ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }

echo " Keyspace hecuba created"
echo " Table istorage created"
Expand All @@ -36,14 +36,14 @@ commands="CREATE KEYSPACE IF NOT EXISTS ${EXECUTION_NAME} WITH replication= {'c
fi


echo $commands | $CASS_HOME/bin/cqlsh ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }
echo $commands | ${CQLSH_CMD} ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }

echo " Keyspace ${EXECUTION_NAME} created"

[ "0${HECUBA_SN_SINGLE_TABLE}" == "0" ] && HECUBA_SN_SINGLE_TABLE="true"
if [[ ${HECUBA_SN_SINGLE_TABLE} != "no" && ${HECUBA_SN_SINGLE_TABLE} != "false" ]]; then
commands="CREATE TABLE IF NOT EXISTS ${EXECUTION_NAME}.hecuba_storagenumpy (storage_id uuid, cluster_id int, block_id int, payload blob, PRIMARY KEY ((storage_id, cluster_id), block_id));"
echo $commands | $CASS_HOME/bin/cqlsh ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }
echo $commands | ${CQLSH_CMD} ${1} || { echo "EXECUTING CQLSH [$commands] FAILED!!!" && exit; }
echo " Table hecuba_storagenumpy created"
fi

Expand Down
4 changes: 2 additions & 2 deletions cassandra4slurm/scripts/job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ echo $CNAMES | tr , '\n' > $PYCOMPSS_STORAGE # Set list of nodes (with interface

check_cassandra_is_available $firstnode

source $MODULE_PATH/initialize_hecuba.sh $firstnode
source $MODULE_PATH/initialize_hecuba.sh $firstnode ${CASS_HOME}/bin/cqlsh

if [ "0$SCHEMA" != "0" ]; then
echo "Connecting to $firstnode for tables creation. Schema $SCHEMA."
Expand Down Expand Up @@ -389,7 +389,7 @@ then
# Looping over the assigned hosts until the snapshots are confirmed
DBG " Launching snapshot tasks on nodes $CASSANDRA_NODELIST"

source $MODULE_PATH/snapshot.sh $SNAP_NAME $ROOT_PATH $CLUSTER $UNIQ_ID
source $MODULE_PATH/snapshot.sh $SNAP_NAME $ROOT_PATH $CLUSTER $UNIQ_ID ${CASSHOME}/bin/nodetool

SNAP_CONT=0
while [ "$SNAP_CONT" != "$N_NODES" ]
Expand Down

0 comments on commit bda3e9e

Please sign in to comment.