Installation file install-cryosparc_v1.sh (cat>>)

Just wanted to point out the default script has “cat >” which doesnt append.

Welcome to the forum @srisri.
On which line of the script should cat append to an existing file instead of overwriting?

Line 73 & 87 (not sure if that was intentional.)


      # Create cluster config files for each GPU partition in SLURM
   for PARTITION in gpu-large gpu-med gpu-small 
   do

   cat > ${CRYOSPARC_INSTALL_PATH}/cluster_info.json <<EOF
{
"qdel_cmd_tpl": "scancel {{ cluster_job_id }}",
"worker_bin_path": "$CRYOSPARC_INSTALL_PATH/cryosparc_worker/bin/cryosparcw",
"title": "cryosparc-cluster",
"cache_path": "",
"qinfo_cmd_tpl": "sinfo",
"qsub_cmd_tpl": "sbatch {{ script_path_abs }}",
"qstat_cmd_tpl": "squeue -j {{ cluster_job_id }}",
"send_cmd_tpl": "{{ command }}",
"name": "$PARTITION"
}
EOF

   cat > ${CRYOSPARC_INSTALL_PATH}/cluster_script.sh <<EOF
#!/bin/bash
#SBATCH --job-name=cryosparc_{{ project_uid }}_{{ job_uid }}
#SBATCH --output={{ job_log_path_abs }}
#SBATCH --error={{ job_log_path_abs }}
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task={{ num_cpu }}
#SBATCH --gres=gpu:{{ num_gpu }}
#SBATCH --partition=$PARTITION
{{ run_cmd }}
EOF

   # Connect worker nodes to cluster
   /bin/su -c "cd ${CRYOSPARC_INSTALL_PATH} && ${CRYOSPARC_INSTALL_PATH}/cryosparc_master/bin/cryosparcm cluster connect" - ec2-user

   done

I think it is intentional:
For each value of PARTITION,

  1. a pair of cluster_info.json and cluster_script.sh is created, potentially overwriting the previous iteration’s files. If cat output were appended to existing files instead, the files would no longer have the correct format.
  2. the command
    cryosparcm cluster connect (guide) is run using the current iteration’s files.

The scripts at the link you sent are merely an example of a possible implementation of a CryoSPARC instance based on cloud infrastructure, but by no means the only possible implementation. Very likely, the optimal implementation for your own needs looks very different.