cryosparc2.utils module

cryosparc2.utils.addComputeSectionParams(form, allowMultipleGPUs=True)[source]

Add the compute settings section


Add the symmetry param with the conventions :param form: :return:

cryosparc2.utils.calculateNewSamplingRate(newDims, previousSR, previousDims)[source]
  • newDims
  • previousSR
  • previousDims

cryosparc2.utils.clearJob(projectName, job)[source]
Clear a Job (if queued) to get it back to builing state (do not clear params or inputs)
  • projectName – the uid of the project that contains the job to clear
  • job – the uid of the job to clear

** IMPORTANT: This method can be launch only if the job is queued

cryosparc2.utils.createEmptyProject(projectDir, projectTitle)[source]
create_empty_project(owner_user_id, project_container_dir, title=None,
cryosparc2.utils.createEmptyWorkSpace(projectName, workspaceTitle, workspaceComment)[source]
create_empty_workspace(project_uid, created_by_user_id,
created_by_job_uid=None, title=None, desc=None)

returns the new uid of the workspace that was created

Given a “root” directory, create a project (PXXX) dir if it doesn’t already
Parameters:project_container_dir – the “root” directory in which to create the project (PXXX) directory
Returns:str - the final path of the new project dir with shell variables still in the returned path (the path should be expanded every time it is used)

Determine if scipion can find cryosparc :returns True if found, False otherwise


Validates some cryo properties that must be satisfy

do_import_particles_star(puid, wuid, uuid, abs_star_path,
abs_blob_path=None, psize_A=None)

returns the new uid of the job that was created

cryosparc2.utils.doImportVolumes(protocol, refVolume, volType, msg)[source]
cryosparc2.utils.doJob(jobType, projectName, workSpaceName, params, input_group_conect)[source]
do_job(job_type, puid=’P1’, wuid=’W1’, uuid=’devuser’, params={},
cryosparc2.utils.enqueueJob(jobType, projectName, workSpaceName, params, input_group_conect, lane, gpusToUse=False, group_connect=None)[source]
make_job(job_type, project_uid, workspace_uid, user_id,
created_by_job_uid=None, params={}, input_group_connects={})

Get the root directory where cryoSPARC code and dependencies are installed.


Get the cryosparc installed version


Get the cryosparc program to launch any command


Get the path on the worker node to a writable directory


Get the full name of the initial admin account

cryosparc2.utils.getJobLog(projectDirName, projectName, job)[source]

Return the job log

cryosparc2.utils.getJobStatus(projectName, job)[source]

Return the job status


returns the name of the cryosparc project based on scipion project name and a hash based on the user name


Gets all projects of given path . projectDir: Folder path to get subfolders. returns: Set with all subfolders.

cryosparc2.utils.getSymmetry(symmetryGroup, symmetryOrder)[source]

Get the symmetry(string) taking into account the symmetry convention


Returns system-related information related to the cryosparc app :returns: dict – dictionary listing information about cryosparc environment {

‘master_hostname’ : master_hostname, ‘port_webapp’ : os.environ[‘CRYOSPARC_HTTP_PORT’], ‘port_mongo’ : os.environ[‘CRYOSPARC_MONGO_PORT’], ‘port_command_core’ : os.environ[‘CRYOSPARC_COMMAND_CORE_PORT’], ‘port_command_vis’ : os.environ[‘CRYOSPARC_COMMAND_VIS_PORT’], ‘port_command_proxy’ : os.environ[‘CRYOSPARC_COMMAND_PROXY_PORT’], ‘port_command_rtp’ : os.environ[‘CRYOSPARC_COMMAND_RTP_PORT’], ‘port_rtp_webapp’ : os.environ[‘CRYOSPARC_HTTP_RTP_PORT’], ‘version’ : get_running_version(),


cryosparc2.utils.get_job_streamlog(projectName, job, fileName)[source]
cryosparc2.utils.gpusValidate(gpuList, checkSingleGPU=False)[source]

Validate a gpu list


Determine if cryosparc services are running :returns True if running, false otherwise

cryosparc2.utils.killJob(projectName, job)[source]
Kill a Job (if running)
  • projectName – the uid of the project that contains the job to kill
  • job – the uid of the job to kill
cryosparc2.utils.runCmd(cmd, printCmd=True)[source]

Runs a command and check its exit code. If different than 0 it raises an exception :parameter cmd command to run

cryosparc2.utils.waitForCryosparc(projectName, jobId, failureMessage)[source]

Waits for cryosparc to finish or fail a job :parameter projectName: Cryosparc project name :parameter jobId: cryosparc job id :parameter failureMessage: Message for the exception thrown in case job fails :returns job Status :raises Exception when parsing cryosparc’s output looks wrong

cryosparc2.utils.waitJob(projectName, job)[source]

Wait while the job not finished