api#
Python functions for programmatically controlling CryoSPARC. To execute functions described in this module directly, you may do one of the following:
Provide function call as a command-line argument to
cryosparcm cli, e.g.,
cryosparcm cli "api.jobs.enqueue('P3', 'J42', lane='default')"
Call interactively in
cryosparcm icli, e.g.,
$ cryosparcm icli
Connected to cryoem0.sbi:61002
api, db, gfs ready to use
In [1]: api.jobs.enqueue('P3', 'J42', lane='default')
In [2]:
Call from a cryosparc-tools script, e.g.,
from cryosparc.tools import CryoSPARC
cs = CryoSPARC(...)
cs.api.jobs.enqueue('P3', 'J42', lane='default')
The api object used in these examples is instance of the APIClient class
defined below. Each attribute of the api object, e.g., api.jobs, is an
instance of one of the ___API classes, e.g., JobsAPI.
Positional v.s. Keyword Arguments#
API functions have positional-only, positional-or-keyword, and keyword-only
arguments. These
are indicated in the function signature by the use of / and * markers:
All arguments before the
/are positional-onlyAll arguments after the
*are keyword-onlyAll arguments in between can be specified either positionally or as keywords.
For example, in the following function signature:
upload(project_uid: str, job_uid: str, /, stream: Stream, *, filename: str | None = None, format: Literal['txt', 'pdf', 'png', ...] | None = None) -> Asset:
project_uidandjob_uidare positional-onlystreamis a positional-or-keywordfilenameandformatare keyword-only
Correct usage when calling this function would be:
api.assets.upload('P3', 'J42', my_stream, filename='output.txt', format='txt')
Examples of incorrect usage:
# INCORRECT USAGE EXAMPLES - will raise TypeError:
api.assets.upload('P3', 'J42', my_stream, 'output.txt', 'txt')
api.assets.upload('P3', job_uid='J42', stream=my_stream, filename='output.txt', format='txt')
api.assets.upload(project_uid='P3', job_uid='J42', stream=my_stream, filename='output.txt', format='txt')
Classes:
Functions and namespaces available in top-level API object. |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
|
Functions available in |
- class APIClient#
Functions and namespaces available in top-level API object. e.g.,
api.read_root(...)orapi.config.get_file_browser_settings(...)Attributes:
api.assetsfunctionsapi.benchmarksfunctionsapi.blueprintsfunctionsapi.cachefunctionsapi.configfunctionsapi.developerfunctionsapi.exposuresfunctionsapi.externalfunctionsapi.instancefunctionsapi.jobsfunctionsapi.notificationsfunctionsapi.projectsfunctionsapi.resourcesfunctionsapi.sessionsfunctionsapi.tagsfunctionsapi.usersfunctionsapi.workflowsfunctionsapi.workspacesfunctionsMethods:
__init__([base_url, auth, headers, timeout])health()Get a specification of available job types and their schemas.
keycloak_login(*, keycloak_access_token)login(*[, expires_in, grant_type, scope, ...])Login form.
start_and_migrate(*, license_id)Start up CryoSPARC for the first time and perform database migrations
test(delay, /)Sleep for the specified number of seconds and returns a value to indicate endpoint is working correctly.
verify_app_session(body)- __init__(base_url: str | None = None, *, auth: str | Tuple[str, str] | None = None, headers: Dict[str, str] | None = None, timeout: float = 300) None#
- Parameters:
base_url (str, optional) – Base URL for CryoSPARC API server. Defaults to None
auth (Auth, optional) – Auth token or email/password. Defaults to None
headers (Dict[str, str], optional) – Default HTTP headers to include in requests. Defaults to None
timeout (float, optional) – Request timeout in seconds. Defaults to 300
- benchmarks: BenchmarksAPI#
api.benchmarksfunctions
- blueprints: BlueprintsAPI#
api.blueprintsfunctions
- developer: DeveloperAPI#
api.developerfunctions
- exposures: ExposuresAPI#
api.exposuresfunctions
- external: ExternalAPI#
api.externalfunctions
- health() str#
- Returns:
Successful Response
- Return type:
str
- instance: InstanceAPI#
api.instancefunctions
- job_register() JobRegister#
Get a specification of available job types and their schemas.
- Returns:
Successful Response
- Return type:
- keycloak_login(*, keycloak_access_token: str) Token#
- Parameters:
keycloak_access_token (str)
- Returns:
Successful Response
- Return type:
- login(*, expires_in: float = 1209600, username: str, password: str, grant_type: str | None = None, scope: str = '', client_id: str | None = None, client_secret: str | None = None) Token#
Login form. Note that plain-text passwords are not accepted; they must be hashed as SHA256.
- Parameters:
expires_in (float, optional) – Token expire time (in seconds). Can be up to 1 year.. Defaults to 1209600
username (str)
password (str)
grant_type (str, optional) – Defaults to None
scope (str, optional) – Defaults to ‘’
client_id (str, optional) – Defaults to None
client_secret (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- notifications: NotificationsAPI#
api.notificationsfunctions
- projects: ProjectsAPI#
api.projectsfunctions
- resources: ResourcesAPI#
api.resourcesfunctions
- sessions: SessionsAPI#
api.sessionsfunctions
- start_and_migrate(*, license_id: str) None#
Start up CryoSPARC for the first time and perform database migrations
- Parameters:
license_id (str)
- test(delay: float, /) str#
Sleep for the specified number of seconds and returns a value to indicate endpoint is working correctly.
- Parameters:
delay (float)
- Returns:
Successful Response
- Return type:
str
- verify_app_session(body: AppSession) str#
- Parameters:
body (AppSession)
- Returns:
Successful Response
- Return type:
str
- workflows: WorkflowsAPI#
api.workflowsfunctions
- workspaces: WorkspacesAPI#
api.workspacesfunctions
- class AssetsAPI#
Functions available in
api.assets, e.g.,api.assets.find(...)Methods:
download([id])Download the asset with the given ID.
find(*[, project_uid, job_uid])List assets associated with projects or jobs on the given instance.
find_one([id])Retrive the full details for an asset with the given ID.
upload(project_uid, job_uid, /, stream, *[, ...])Upload a new asset associated with the given project/job.
- download(id: str = '000000000000000000000000', /) Stream#
Download the asset with the given ID. When calling via HTTP, file contents will be in the response body.
- Parameters:
id (str, optional) – Defaults to ‘000000000000000000000000’
- Returns:
A binary stream representing a Stream class instance
- Return type:
- find(*, project_uid: str | None = None, job_uid: str | None = None) List[GridFSFile]#
List assets associated with projects or jobs on the given instance. Typically returns files creating during job runs, including plots and metadata.
- Parameters:
project_uid (str, optional) – Defaults to None
job_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[GridFSFile]
- find_one(id: str = '000000000000000000000000', /) GridFSFile#
Retrive the full details for an asset with the given ID.
- Parameters:
id (str, optional) – Defaults to ‘000000000000000000000000’
- Returns:
Successful Response
- Return type:
- upload(project_uid: str, job_uid: str, /, stream: Stream, *, filename: str | None = None, format: Literal['txt', 'csv', 'html', 'json', 'xml', 'bild', 'bld', 'log'] | Literal['pdf', 'gif', 'jpg', 'jpeg', 'png', 'svg'] | None = None) GridFSAsset#
Upload a new asset associated with the given project/job. When calling via HTTP, provide the contents of the file in the request body. At least one of filename or format must be provided.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str)
stream (Stream) – A binary stream representing a Stream class instance
filename (str, optional) – Defaults to None
format (Literal['txt', 'csv', 'html', 'json', 'xml', 'bild', 'bld', 'log'] | Literal['pdf', 'gif', 'jpg', 'jpeg', 'png', 'svg'], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- Auth(*args, **kwargs)#
Auth token or email/password.
alias of
str|Tuple[str,str]
- class BenchmarksAPI#
Functions available in
api.benchmarks, e.g.,api.benchmarks.get_reference_benchmarks(...)Methods:
get_benchmark(project_uid, job_uid, ...)- get_benchmark(project_uid: str, job_uid: str, benchmark_type: str, /) PerformanceBenchmark#
- Parameters:
project_uid (str)
job_uid (str)
benchmark_type (str)
- Returns:
Successful Response
- Return type:
- get_reference_benchmarks() List[ReferencePerformanceBenchmark]#
- Returns:
Successful Response
- Return type:
- class BlueprintsAPI#
Functions available in
api.blueprints, e.g.,api.blueprints.create_blueprint(...)Methods:
apply_blueprint(blueprint_id, /, schema, *, ...)For cryosparc app only
create_blueprint(schema, *, blueprint_id, ...)For cryosparc app only
delete_blueprint(blueprint_id, /, *, job_type)For cryosparc app only
edit_blueprint(blueprint_id, /, schema, *, ...)For cryosparc app only
- apply_blueprint(blueprint_id: str, /, schema: Dict[str, Any], *, project_uid: str, job_uid: str, job_type: str) None#
For cryosparc app only
- Parameters:
blueprint_id (str)
schema (Dict[str, Any])
project_uid (str)
job_uid (str)
job_type (str)
- create_blueprint(schema: Dict[str, Any], *, blueprint_id: str, imported: bool, project_uid: str, job_uid: str, job_type: str) None#
For cryosparc app only
- Parameters:
schema (Dict[str, Any])
blueprint_id (str)
imported (bool)
project_uid (str)
job_uid (str)
job_type (str)
- delete_blueprint(blueprint_id: str, /, *, job_type: str) None#
For cryosparc app only
- Parameters:
blueprint_id (str)
job_type (str)
- edit_blueprint(blueprint_id: str, /, schema: Dict[str, Any], *, project_uid: str, job_uid: str, job_type: str) None#
For cryosparc app only
- Parameters:
blueprint_id (str)
schema (Dict[str, Any])
project_uid (str)
job_uid (str)
job_type (str)
- class CacheAPI#
Functions available in
api.cache, e.g.,api.cache.get(...)Methods:
get(key, /, *[, namespace])Returns None if the value is not set or expired
set(key, /[, value, namespace, ttl])Sets key to the given value, with a ttl (Time-to-Live) in seconds
- get(key: str, /, *, namespace: str | None = None) Any#
Returns None if the value is not set or expired
- Parameters:
key (str)
namespace (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
Any
- set(key: str, /, value: Any | None = None, *, namespace: str | None = None, ttl: int = 60) None#
Sets key to the given value, with a ttl (Time-to-Live) in seconds
- Parameters:
key (str)
value (Any, optional) – Defaults to None
namespace (str, optional) – Defaults to None
ttl (int, optional) – Defaults to 60
- class ConfigAPI#
Functions available in
api.config, e.g.,api.config.get_file_browser_settings(...)Methods:
get(name, /, *[, default])Gets config collection entry value for the given variable name.
Gets this CryoSPARC instance's unique UID.
System information related to the CryoSPARC application
Gets the current CryoSPARC version (with patch suffix, if available)
set_default_job_priority(value)Job priority
set_instance_banner(*[, active, title, body])set_login_message(*[, active, title, body])write(name, /[, value, set_on_insert_only])Sets config collection entry.
- get(name: str, /, *, default: Any = '<<UNDEFINED>>') Any#
Gets config collection entry value for the given variable name.
- Parameters:
name (str)
default (Any, optional) – Defaults to ‘<<UNDEFINED>>’
- Returns:
Successful Response
- Return type:
Any
- get_file_browser_settings() FileBrowserPrefixes#
- Returns:
Instance file browser settings
- Return type:
- get_instance_uid() str#
Gets this CryoSPARC instance’s unique UID.
- Returns:
Successful Response
- Return type:
str
- get_system_info() SystemInfo#
System information related to the CryoSPARC application
- Returns:
Successful Response
- Return type:
- get_version() str#
Gets the current CryoSPARC version (with patch suffix, if available)
- Returns:
Successful Response
- Return type:
str
- set_default_job_priority(value: int) Any#
Job priority
- Parameters:
value (int)
- Returns:
Successful Response
- Return type:
Any
- set_file_browser_settings(body: FileBrowserPrefixes) Any#
- Parameters:
body (FileBrowserPrefixes)
- Returns:
Successful Response
- Return type:
Any
- set_instance_banner(*, active: bool = False, title: str | None = None, body: str | None = None) Any#
- Parameters:
active (bool, optional) – Defaults to False
title (str, optional) – Defaults to None
body (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
Any
- set_login_message(*, active: bool = False, title: str | None = None, body: str | None = None) Any#
- Parameters:
active (bool, optional) – Defaults to False
title (str, optional) – Defaults to None
body (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
Any
- write(name: str, /, value: Any | None = None, *, set_on_insert_only: bool = False) Any#
Sets config collection entry. Specify set_on_insert_only to prevent overwriting when the value already exists.
- Parameters:
name (str)
value (Any, optional) – Defaults to None
set_on_insert_only (bool, optional) – Defaults to False
- Returns:
Value in the database
- Return type:
Any
- class DeveloperAPI#
Functions available in
api.developer, e.g.,api.developer.get_developers(...)
- class ExposuresAPI#
Functions available in
api.exposures, e.g.,api.exposures.find(...)Methods:
add_manual_pick(project_uid, session_uid, ...)Adds a manual pick to an exposure.
count(*[, order, after, limit, uid, ...])find(*[, order, after, limit, uid, ...])find_one(project_uid, session_uid, ...)get_individual_picks(project_uid, ...)Gets list of picks from an exposure
manual_reject_exposure(project_uid, ...)Manually rejects exposure.
manual_unreject_exposure(project_uid, ...)Manually unrejects exposure.
mark_failed(project_uid, session_uid, ...)Mark an exposure as failed.
remove_manual_pick(project_uid, session_uid, ...)Removes manual pick from an exposure
reprocess_single_exposure(project_uid, ...)Reprocesses a single micrograph with the passed parameters.
reset_all_exposures(project_uid, session_uid, /)Resets all exposures in a session to initial state.
reset_exposure(project_uid, session_uid, ...)Resets exposure to intial state.
reset_failed_exposures(project_uid, ...)Resets all failed exposures in a session to initial state.
reset_manual_reject_exposures(project_uid, ...)Resets manual rejection status on all exposures in a session.
toggle_manual_reject_exposure(project_uid, ...)Toggles manual rejection state on exposure.
- add_manual_pick(project_uid: str, session_uid: str, exposure_uid: int, /, *, x_frac: float, y_frac: float) Exposure#
Adds a manual pick to an exposure.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
x_frac (float)
y_frac (float)
- Returns:
Exposure with added manual picks
- Return type:
- count(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, session_uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, stage: List[Literal['go_to_found', 'found', 'check', 'motion', 'ctf', 'thumbs', 'pick', 'extract', 'extract_manual', 'ready', 'restoring', 'restoring_motion', 'restoring_thumbs', 'restoring_ctf', 'restoring_extract', 'restoring_extract_manual', 'compacted']] | None = None, deleted: bool | None = False) int#
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
session_uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
stage (List[Literal['go_to_found', 'found', 'check', 'motion', 'ctf', 'thumbs', 'pick', 'extract', 'extract_manual', 'ready', 'restoring', 'restoring_motion', 'restoring_thumbs', 'restoring_ctf', 'restoring_extract', 'restoring_extract_manual', 'compacted']], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
int
- find(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, session_uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, stage: List[Literal['go_to_found', 'found', 'check', 'motion', 'ctf', 'thumbs', 'pick', 'extract', 'extract_manual', 'ready', 'restoring', 'restoring_motion', 'restoring_thumbs', 'restoring_ctf', 'restoring_extract', 'restoring_extract_manual', 'compacted']] | None = None, deleted: bool | None = False) List[Exposure]#
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
session_uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
stage (List[Literal['go_to_found', 'found', 'check', 'motion', 'ctf', 'thumbs', 'pick', 'extract', 'extract_manual', 'ready', 'restoring', 'restoring_motion', 'restoring_thumbs', 'restoring_ctf', 'restoring_extract', 'restoring_extract_manual', 'compacted']], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
List[Exposure]
- find_one(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
- Returns:
Successful Response
- Return type:
- get_individual_picks(project_uid: str, session_uid: str, exposure_uid: int, picker_type: Literal['blob', 'template', 'manual'], /) List[List[float]]#
Gets list of picks from an exposure
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
picker_type (Literal['blob', 'template', 'manual'])
- Returns:
Successful Response
- Return type:
List[List[float]]
- manual_reject_exposure(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
Manually rejects exposure.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
- Returns:
Rejected exposure
- Return type:
- manual_unreject_exposure(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
Manually unrejects exposure.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
- Returns:
Unrejected exposure
- Return type:
- mark_failed(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
Mark an exposure as failed.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
- Returns:
Successful Response
- Return type:
- remove_manual_pick(project_uid: str, session_uid: str, exposure_uid: int, /, *, x_frac: float, y_frac: float, dist_frac: float = 0.02) Exposure#
Removes manual pick from an exposure
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
x_frac (float)
y_frac (float)
dist_frac (float, optional) – Defaults to 0.02
- Returns:
Exposure with removed manual picks
- Return type:
- reprocess_single_exposure(project_uid: str, session_uid: str, exposure_uid: int, /, body: LivePreprocessingParams, *, picker_type: Literal['blob', 'template']) Exposure#
Reprocesses a single micrograph with the passed parameters. If there is a test micrograph in the session already that is not the same micrograph that the user is currently trying to test, it will be reset back to the “ctf” stage without the test flag.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
body (LivePreprocessingParams)
picker_type (Literal['blob', 'template']) – Automatic picker types available in Live.
- Returns:
Reprocessed exposure
- Return type:
- reset_all_exposures(project_uid: str, session_uid: str, /) None#
Resets all exposures in a session to initial state.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- reset_exposure(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
Resets exposure to intial state.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_uid (int)
- Returns:
Exposure that has been reset
- Return type:
- reset_failed_exposures(project_uid: str, session_uid: str, /) None#
Resets all failed exposures in a session to initial state.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- reset_manual_reject_exposures(project_uid: str, session_uid: str, /) List[Exposure]#
Resets manual rejection status on all exposures in a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
List of exposures reset
- Return type:
List[Exposure]
- class ExternalAPI#
Functions available in
api.external, e.g.,api.external.get_empiar_latest_entries(...)Methods:
- get_changelog() Dict[str, Any]#
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_discuss_categories() Dict[str, Any]#
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_discuss_top() Dict[str, Any]#
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_emdb_latest_entries() List[Dict[str, Any]]#
- Returns:
Successful Response
- Return type:
List[Dict[str, Any]]
- get_empiar_latest_entries() Dict[str, Any]#
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_tutorials() Dict[str, Any]#
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- class InstanceAPI#
Functions available in
api.instance, e.g.,api.instance.get_update_tag(...)Methods:
audit_dump(*[, timestamp])Generate an audit dump file containing all audit logs since the given timestamp.
browse_files(*, abs_path_glob)Request details for a set of files or directories available to CryoSPARC, given an absolute path or glob expression.
Checks if embedded CryoSPARC Live is enabled
generate_new_uid(*[, force_takeover_projects])Generates a new uid for the CryoSPARC instance If force_takeover_projects is True, overwrites existing lockfiles, otherwise, creates lockfiles in projects that don't already have one.
Gets runtime diagnostics for the CryoSPARC instance
get_service_log(service, /, *[, days, date, ...])Gets cryosparc service logs, filterable by date.
Gets information about updating to the next CryoSPARC version, if one is available.
Checks if CryoSPARC Live is enabled
- audit_dump(*, timestamp: float | Literal['auto'] | None = None) str | None#
Generate an audit dump file containing all audit logs since the given timestamp.
- Parameters:
timestamp (float | Literal['auto'], optional) – Leave unspecified to dump all audit logs, set to “auto” to dump new logs since the last dump, or set to a UNIX timestamp to dump every log that occurred after it.. Defaults to None
- Returns:
Successful Response
- Return type:
str | None
- browse_files(*, abs_path_glob: str) BrowseFileResponse#
Request details for a set of files or directories available to CryoSPARC, given an absolute path or glob expression. If the given path is a directory, returns a list all files in that directory.
Note
abs_path_globmay have shell variables in it (e.g.,$HOME,$SCRATCH). Variables are expanded before globs.- Parameters:
abs_path_glob (str)
- Returns:
List of available file details.
- Return type:
- ecl_enabled() bool#
Checks if embedded CryoSPARC Live is enabled
- Returns:
Successful Response
- Return type:
bool
- generate_new_uid(*, force_takeover_projects: bool = False) str#
Generates a new uid for the CryoSPARC instance If force_takeover_projects is True, overwrites existing lockfiles, otherwise, creates lockfiles in projects that don’t already have one.
- Parameters:
force_takeover_projects (bool, optional) – Defaults to False
- Returns:
New instance UID
- Return type:
str
- get_license_usage() List[LicenseInstance]#
- Returns:
Successful Response
- Return type:
List[LicenseInstance]
- get_runtime_diagnostics() RuntimeDiagnostics#
Gets runtime diagnostics for the CryoSPARC instance
- Returns:
Successful Response
- Return type:
- get_service_log(service: Literal['app', 'database', 'cache', 'api', 'scheduler', 'command_vis', 'app_api', 'supervisord'], /, *, days: int = 30, date: str | None = None, max_lines: int | None = None) str#
Gets cryosparc service logs, filterable by date. Only lines with a date are counted for max_lines.
- Parameters:
service (LoggingService)
days (int, optional) – Defaults to 30
date (str, optional) – Defaults to None
max_lines (int, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
str
- get_update_tag() UpdateTag | None#
Gets information about updating to the next CryoSPARC version, if one is available.
- Returns:
Successful Response
- Return type:
UpdateTag | None
- live_enabled() bool#
Checks if CryoSPARC Live is enabled
- Returns:
Successful Response
- Return type:
bool
- class JobsAPI#
Functions available in
api.jobs, e.g.,api.jobs.find(...)Methods:
add_checkpoint(project_uid, job_uid, /, meta)Add a checkpoint the target job's event log.
add_event_log(project_uid, job_uid, /, text, *)Add the message to the target job's event log.
add_external_input(project_uid, job_uid, ...)Add or replace an external job's input.
add_external_output(project_uid, job_uid, ...)Add or replace an external job's output.
add_image_log(project_uid, job_uid, /, ...)Add an image or figure to the target job's event log.
add_tag(project_uid, job_uid, tag_uid, /)Tags a job with the given tag.
clear(project_uid, job_uid, /)Clears a job to get it back to building state (do not clear params or inputs).
clear_intermediate_results(project_uid, ...)Removes intermediate results from the job
clear_many(*[, order, after, limit, ...])Clears all jobs that matches the query.
clear_param(project_uid, job_uid, param, /)Resets the given parameter to its default value.
clone(project_uid, job_uid, /, *[, ...])Creates a new job as a clone of the provided job.
clone_chain(project_uid, /, *, ...[, ...])Clones jobs that directly descend from the start job UID up to the end job UID.
clone_many(project_uid, /, job_uids, *[, ...])Clones the given list of jobs.
connect(project_uid, job_uid, input_name, /, ...)Connects the input slot on the child job to the output group on the parent job.
connect_result(project_uid, job_uid, ...[, ...])Adds or replaces a result within an input connection with the given output result from a different job.
count(*[, order, after, limit, project_uid, ...])Counts number of jobs that match the supplied query.
create(project_uid, workspace_uid, /[, ...])Creates a new job with the given type in the project/workspace
create_external_result(project_uid, ...)Create an external result with the given specification.
delete(project_uid, job_uid, /)Deletes a job.
delete_many(project_job_uids)Deletes the given jobs.
delete_output_result_files(project_uid, ...)Remove all data files referenced in a job's output result.
disconnect(project_uid, job_uid, input_name, ...)Removes connected inputs on the given input.
disconnect_all(project_uid, job_uid, ...)disconnect_result(project_uid, job_uid, ...)Removes an output result connected within the given input connection.
enqueue(project_uid, job_uid, /, *[, lane, ...])Adds the job to the queue for the given worker lane (default lane if not specified)
export_job(project_uid, job_uid, /)Start export for the job into the project's exports directory
export_output_results(project_uid, job_uid, ...)Prepares a job's output for import to another project or instance.
find(*[, order, after, limit, project_uid, ...])Finds all jobs that match the supplied query
find_ancestor_uids(project_uid, job_uid, /, *)Finds all ancestors of a single job and return a list of their UIDs
find_descendant_uids(project_uid, job_uid, /, *)Find the list of all job UIDs that this job is an ancestor of based on its outputs.
find_one(project_uid, job_uid, /)Finds the job.
find_output_result(project_uid, job_uid, ...)Get a job's low-level output result.
Counts number of active jobs.
Gets number of acquired licenses for running jobs
Gets job types by category
get_chain(project_uid, /, *, start_job_uid, ...)Finds the chain of jobs between start job to end job.
get_directory(project_uid, job_uid, /)Gets the job directory for a given job.
get_event_logs(project_uid, job_uid, /, *[, ...])Gets all event logs for a job.
get_final_results(project_uid, /)Gets all final results within a project, along with the ancestors and non-ancestors of those jobs.
get_log(project_uid, job_uid, /)Returns contents of the job.log file.
get_log_path(project_uid, job_uid, /)get_output_fields(project_uid, job_uid, ...)Expected dataset column definitions for given job output, excluding passthroughs.
get_output_result_path(project_uid, job_uid, ...)Get the absolute path for a job output's dataset or volume density.
get_status(project_uid, job_uid, /)Gets the status of a job.
Gets list of available job types
import_job(project_uid, workspace_uid, /, *)Imports the exported job directory into the project.
import_result_group(project_uid, ...[, ...])Creates and enqueues an Import Result Group job with the given path
interactive_post(project_uid, job_uid, /, ...)Sends a message to an interactive job.
kill(project_uid, job_uid, /)Kills a running job
link_to_workspace(project_uid, job_uid, ...)Adds a job to a workspace.
load_input(project_uid, job_uid, input_name, ...)Load job input dataset.
load_output(project_uid, job_uid, ...[, ...])Load job output dataset.
mark_completed(project_uid, job_uid, /)Mark a killed or failed job, or an active external job, as completed.
mark_failed(project_uid, job_uid, /, *[, error])Manually mark a job as failed.
mark_running(project_uid, job_uid, /, *[, ...])Indicate that an external job is running or waiting.
move(project_uid, job_uid, /, *, ...)Moves a job from one workspace to another.
Recaclulates intermediate result sizes for all jobs in a project.
recalculate_size(project_uid, job_uid, /)Recalculates the size of a given job's directory.
recalculate_size_async(project_uid, job_uid, /)For a job, find intermediate results and recalculate their total size.
reconnect(project_uid, job_uid, input_name, ...)Replace the connection at the given index with a new connection.
remove_tag(project_uid, job_uid, tag_uid, /)Removes the given tag a job.
save_output(project_uid, job_uid, ...[, ...])Save job output dataset.
set_cluster_custom_vars(project_uid, ...)Sets cluster custom variables for job
set_description(project_uid, job_uid, /, ...)Sets job description.
set_final_result(project_uid, job_uid, /, *, ...)Marks a job as a final result.
set_output_image(project_uid, job_uid, ...)Set a custom image for an External job output.
set_param(project_uid, job_uid, param, /, value)Sets the given job parameter to the value
set_priority(project_uid, job_uid, /, *, ...)Sets job priority
set_tile_image(project_uid, job_uid, /, body)Set a custom job tile image for an External job.
set_title(project_uid, job_uid, /, *, title)Sets job title.
star_job(project_uid, job_uid, /)Stars a job for a user
unlink_from_workspace(project_uid, job_uid, ...)Removes a job from a workspace.
unstar_job(project_uid, job_uid, /)Unstars a job for a user
update_directory_symlinks(project_uid, ...)Rewrites all symbolic links in the job directory, modifying links prefixed with prefix_cut to instead be prefixed with prefix_new.
update_event_log(project_uid, job_uid[, ...])Update a text event log entry for a job.
view(project_uid, workspace_uid, job_uid, /)Adds a project, workspace and job uid to a user's recently viewed jobs list
- add_checkpoint(project_uid: str, job_uid: str, /, meta: Dict[str, Any]) CheckpointEvent#
Add a checkpoint the target job’s event log.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
meta (Dict[str, Any])
- Returns:
Successful Response
- Return type:
- add_event_log(project_uid: str, job_uid: str, /, text: str, *, type: Literal['text', 'warning', 'error'] = 'text') TextEvent#
Add the message to the target job’s event log.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
text (str)
type (Literal['text', 'warning', 'error'], optional) – Defaults to ‘text’
- Returns:
Successful Response
- Return type:
- add_external_input(project_uid: str, job_uid: str, input_name: str, /, body: InputSpec) Job#
Add or replace an external job’s input. This action is available while the job is building, running or waiting for results.
- add_external_output(project_uid: str, job_uid: str, output_name: str, /, body: OutputSpec) Job#
Add or replace an external job’s output. This action is available while the job is building, running or waiting for results.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str) – May only contain letters, numbers and underscores, and must start with a letter
body (OutputSpec)
- Returns:
Successful Response
- Return type:
- add_image_log(project_uid: str, job_uid: str, /, images: List[GridFSAsset], *, text: str, flags: List[str] = ['plots']) ImageEvent#
Add an image or figure to the target job’s event log.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
images (List[GridFSAsset])
text (str)
flags (List[str], optional) – Defaults to [‘plots’]
- Returns:
Successful Response
- Return type:
- add_tag(project_uid: str, job_uid: str, tag_uid: str, /) Job#
Tags a job with the given tag.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- clear(project_uid: str, job_uid: str, /) Job#
Clears a job to get it back to building state (do not clear params or inputs).
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- clear_intermediate_results(project_uid: str, job_uid: str, /, *, always_keep_final: bool = True) None#
Removes intermediate results from the job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
always_keep_final (bool, optional) – Defaults to True
- clear_many(*, order: int = 1, after: str | None = None, limit: int = 100, project_uid: List[str] | None = None, workspace_uid: List[str] | None = None, uid: List[str] | None = None, type: List[str] | None = None, status: List[Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']] | None = None, category: List[Literal['import', 'motion_correction', 'ctf_estimation', 'exposure_curation', 'particle_picking', 'extraction', 'deep_picker', 'particle_curation', 'reconstruction', 'refinement', 'ctf_refinement', 'variability', 'flexibility', 'postprocessing', 'local_refinement', 'helix', 'utilities', 'simulations', 'live', 'instance_testing', 'workflows']] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, queued_at: Tuple[datetime, datetime] | None = None, started_at: Tuple[datetime, datetime] | None = None, waiting_at: Tuple[datetime, datetime] | None = None, completed_at: Tuple[datetime, datetime] | None = None, killed_at: Tuple[datetime, datetime] | None = None, failed_at: Tuple[datetime, datetime] | None = None, exported_at: Tuple[datetime, datetime] | None = None, deleted: bool | None = False) List[Job]#
Clears all jobs that matches the query.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
project_uid (List[str], optional) – Defaults to None
workspace_uid (List[str], optional) – Defaults to None
uid (List[str], optional) – Defaults to None
type (List[str], optional) – Defaults to None
status (List[JobStatus], optional) – Defaults to None
category (List[Category], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
queued_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
started_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
waiting_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
completed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
killed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
failed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
exported_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
List[Job]
- clear_param(project_uid: str, job_uid: str, param: str, /) Job#
Resets the given parameter to its default value.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
param (str)
- Returns:
Successful Response
- Return type:
- clone(project_uid: str, job_uid: str, /, *, workspace_uid: str | None = None, created_by_job_uid: str | None = None) Job#
Creates a new job as a clone of the provided job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str, optional) – Defaults to None
created_by_job_uid (str, optional) – Defaults to None
- Returns:
Cloned job
- Return type:
- clone_chain(project_uid: str, /, *, start_job_uid: str, end_job_uid: str, workspace_uid: str | None = None, new_workspace_title: str | None = None) List[Job]#
Clones jobs that directly descend from the start job UID up to the end job UID.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
start_job_uid (str)
end_job_uid (str)
workspace_uid (str, optional) – Defaults to None
new_workspace_title (str, optional) – Defaults to None
- Returns:
Newly created cloned jobs
- Return type:
List[Job]
- clone_many(project_uid: str, /, job_uids: List[str], *, workspace_uid: str | None = None, new_workspace_title: str | None = None) List[Job]#
Clones the given list of jobs. If any jobs are related, it will try to re-create the input connections between the cloned jobs (but maintain the same connections to jobs that were not cloned)
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uids (List[str])
workspace_uid (str, optional) – Defaults to None
new_workspace_title (str, optional) – Defaults to None
- Returns:
List of cloned jobs
- Return type:
List[Job]
- connect(project_uid: str, job_uid: str, input_name: str, /, *, source_output_name: str, source_job_uid: str) Job#
Connects the input slot on the child job to the output group on the parent job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
source_output_name (str)
source_job_uid (str)
- Returns:
Connected child job
- Return type:
- connect_result(project_uid: str, job_uid: str, input_name: str, connection_index: int, result_name: str, /, *, source_output_name: str, source_result_name: str, source_result_version: int | Literal['F'] = 'F', source_job_uid: str) Job#
Adds or replaces a result within an input connection with the given output result from a different job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
connection_index (int)
result_name (str)
source_output_name (str)
source_result_name (str)
source_result_version (int | Literal['F'], optional) – Defaults to ‘F’
source_job_uid (str)
- Returns:
Successful Response
- Return type:
- count(*, order: int = 1, after: str | None = None, limit: int = 100, project_uid: List[str] | None = None, workspace_uid: List[str] | None = None, uid: List[str] | None = None, type: List[str] | None = None, status: List[Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']] | None = None, category: List[Literal['import', 'motion_correction', 'ctf_estimation', 'exposure_curation', 'particle_picking', 'extraction', 'deep_picker', 'particle_curation', 'reconstruction', 'refinement', 'ctf_refinement', 'variability', 'flexibility', 'postprocessing', 'local_refinement', 'helix', 'utilities', 'simulations', 'live', 'instance_testing', 'workflows']] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, queued_at: Tuple[datetime, datetime] | None = None, started_at: Tuple[datetime, datetime] | None = None, waiting_at: Tuple[datetime, datetime] | None = None, completed_at: Tuple[datetime, datetime] | None = None, killed_at: Tuple[datetime, datetime] | None = None, failed_at: Tuple[datetime, datetime] | None = None, exported_at: Tuple[datetime, datetime] | None = None, deleted: bool | None = False) int#
Counts number of jobs that match the supplied query.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
project_uid (List[str], optional) – Defaults to None
workspace_uid (List[str], optional) – Defaults to None
uid (List[str], optional) – Defaults to None
type (List[str], optional) – Defaults to None
status (List[JobStatus], optional) – Defaults to None
category (List[Category], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
queued_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
started_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
waiting_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
completed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
killed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
failed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
exported_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
int
- create(project_uid: str, workspace_uid: str, /, params: Dict[str, bool | int | float | str | None] = {}, *, type: str, title: str = '', description: str = '', created_by_job_uid: str | None = None, enable_bench: bool = False) Job#
Creates a new job with the given type in the project/workspace
To see all available job types and their parameters, see the GET projects/{project_uid}:register endpoint
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
params (Dict[str, Union[bool, int, float, str, str, None]], optional) – Defaults to {}
type (str) – Type of job to create
title (str, optional) – Defaults to ‘’
description (str, optional) – Defaults to ‘’
created_by_job_uid (str, optional) – Defaults to None
enable_bench (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
- create_external_result(project_uid: str, workspace_uid: str, /, body: ExternalOutputSpec) Job#
Create an external result with the given specification. Returns an external job with the given output ready to be saved. Used with cryosparc-tools
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
body (ExternalOutputSpec)
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, job_uid: str, /) None#
Deletes a job. Will kill (if running) and clearing the job before deleting.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- delete_many(project_job_uids: List[Tuple[str, str]]) None#
Deletes the given jobs. Ignores protected jobs if force is True.
- Parameters:
project_job_uids (List[Tuple[str, str]])
- delete_output_result_files(project_uid: str, job_uid: str, output_name: str, result_name: str, /) None#
Remove all data files referenced in a job’s output result. For example, for an Extract Particles job, specify the “particles” output and “blob” result to remove the particle stacks created by the job.
Has no effect when clearing results from jobs where the result was passed through from an ancenstor job, e.g., cannot clear “blob” result from a 2D Classification job connected to the Extract job.
This operation may affect downstream jobs that use these files as input.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
result_name (str)
- disconnect(project_uid: str, job_uid: str, input_name: str, connection_index: int, /) Job#
Removes connected inputs on the given input.
Optionally specify an index to disconnect a specific connection.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
connection_index (int)
- Returns:
Successful Response
- Return type:
- disconnect_all(project_uid: str, job_uid: str, input_name: str, /) Job#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
- Returns:
Successful Response
- Return type:
- disconnect_result(project_uid: str, job_uid: str, input_name: str, connection_index: int, result_name: str, /) Job#
Removes an output result connected within the given input connection.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
connection_index (int)
result_name (str)
- Returns:
Successful Response
- Return type:
- enqueue(project_uid: str, job_uid: str, /, *, lane: str | None = None, hostname: str | None = None, gpus: List[int] = [], no_check_inputs_ready: bool = False) Job#
Adds the job to the queue for the given worker lane (default lane if not specified)
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
lane (str, optional) – Defaults to None
hostname (str, optional) – Defaults to None
gpus (List[int], optional) – Defaults to []
no_check_inputs_ready (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
- export_job(project_uid: str, job_uid: str, /) None#
Start export for the job into the project’s exports directory
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- export_output_results(project_uid: str, job_uid: str, output_name: str, /, result_names: List[str] | None = None) None#
Prepares a job’s output for import to another project or instance. Creates a folder in the project directory → exports subfolder, then links the output’s associated files there.
Note that the returned .csg file’s parent folder must be manually copied with symlinks resolved into the target project folder before importing.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
result_names (List[str], optional) – Defaults to None
- find(*, order: int = 1, after: str | None = None, limit: int = 100, project_uid: List[str] | None = None, workspace_uid: List[str] | None = None, uid: List[str] | None = None, type: List[str] | None = None, status: List[Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']] | None = None, category: List[Literal['import', 'motion_correction', 'ctf_estimation', 'exposure_curation', 'particle_picking', 'extraction', 'deep_picker', 'particle_curation', 'reconstruction', 'refinement', 'ctf_refinement', 'variability', 'flexibility', 'postprocessing', 'local_refinement', 'helix', 'utilities', 'simulations', 'live', 'instance_testing', 'workflows']] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, queued_at: Tuple[datetime, datetime] | None = None, started_at: Tuple[datetime, datetime] | None = None, waiting_at: Tuple[datetime, datetime] | None = None, completed_at: Tuple[datetime, datetime] | None = None, killed_at: Tuple[datetime, datetime] | None = None, failed_at: Tuple[datetime, datetime] | None = None, exported_at: Tuple[datetime, datetime] | None = None, deleted: bool | None = False) List[Job]#
Finds all jobs that match the supplied query
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
project_uid (List[str], optional) – Defaults to None
workspace_uid (List[str], optional) – Defaults to None
uid (List[str], optional) – Defaults to None
type (List[str], optional) – Defaults to None
status (List[JobStatus], optional) – Defaults to None
category (List[Category], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
queued_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
started_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
waiting_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
completed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
killed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
failed_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
exported_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
List of jobs matching supplied query
- Return type:
List[Job]
- find_ancestor_uids(project_uid: str, job_uid: str, /, *, workspace_uid: str | None = None) List[str]#
Finds all ancestors of a single job and return a list of their UIDs
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[str]
- find_descendant_uids(project_uid: str, job_uid: str, /, *, workspace_uid: str | None = None) List[str]#
Find the list of all job UIDs that this job is an ancestor of based on its outputs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[str]
- find_one(project_uid: str, job_uid: str, /) Job#
Finds the job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- find_output_result(project_uid: str, job_uid: str, output_name: str, result_name: str, /) OutputResult#
Get a job’s low-level output result.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
result_name (str)
- Returns:
Successful Response
- Return type:
- get_active_count() int#
Counts number of active jobs.
- Returns:
Successful Response
- Return type:
int
- get_active_licenses_count() int#
Gets number of acquired licenses for running jobs
- Returns:
Successful Response
- Return type:
int
- get_categories() Any#
Gets job types by category
- Returns:
Successful Response
- Return type:
Any
- get_chain(project_uid: str, /, *, start_job_uid: str, end_job_uid: str) List[str]#
Finds the chain of jobs between start job to end job. A job chain is the intersection of the start job’s descendants and the end job’s ancestors.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
start_job_uid (str)
end_job_uid (str)
- Returns:
Successful Response
- Return type:
List[str]
- get_directory(project_uid: str, job_uid: str, /) str#
Gets the job directory for a given job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
str
- get_event_logs(project_uid: str, job_uid: str, /, *, checkpoint: int | None = None) List[TextEvent | ImageEvent | InteractiveEvent | CheckpointEvent | Event]#
Gets all event logs for a job.
Note: this may return a lot of documents.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
checkpoint (int, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[Union[TextEvent, ImageEvent, InteractiveEvent, CheckpointEvent, Event]]
- get_final_results(project_uid: str, /) GetFinalResultsResponse#
Gets all final results within a project, along with the ancestors and non-ancestors of those jobs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- get_log(project_uid: str, job_uid: str, /) str#
Returns contents of the job.log file. Returns empty string if job.log does not exist.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
str
- get_log_path(project_uid: str, job_uid: str, /) str#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
str
- get_output_fields(project_uid: str, job_uid: str, output_name: str, /, dtype_params: Dict[str, Any] = {}) List[Tuple[str, str]]#
Expected dataset column definitions for given job output, excluding passthroughs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
dtype_params (Dict[str, Any], optional) – Defaults to {}
- Returns:
Successful Response
- Return type:
List[Tuple[str, str]]
- get_output_result_path(project_uid: str, job_uid: str, output_name: str, result_name: str, /, *, version: int | Literal['F'] = 'F') str#
Get the absolute path for a job output’s dataset or volume density.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
result_name (str)
version (int | Literal['F'], optional) – Defaults to ‘F’
- Returns:
Successful Response
- Return type:
str
- get_status(project_uid: str, job_uid: str, /) Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']#
Gets the status of a job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
JobStatus
- get_types() Any#
Gets list of available job types
- Returns:
Successful Response
- Return type:
Any
- import_job(project_uid: str, workspace_uid: str, /, *, path: str = '') None#
Imports the exported job directory into the project. Exported job directory must be copied to the target project directory with all its symbolic links resolved. By convention, the exported job directory should be located in the project directory → exports subfolder
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- import_result_group(project_uid: str, workspace_uid: str, /, *, lane: str | None = None, path: str = '') Job#
Creates and enqueues an Import Result Group job with the given path
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
lane (str, optional) – Defaults to None
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
- interactive_post(project_uid: str, job_uid: str, /, body: Dict[str, Any], *, endpoint: str, timeout: int = 10) Any#
Sends a message to an interactive job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
body (Dict[str, Any])
endpoint (str)
timeout (int, optional) – Defaults to 10
- Returns:
Successful Response
- Return type:
Any
- kill(project_uid: str, job_uid: str, /) Job#
Kills a running job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- link_to_workspace(project_uid: str, job_uid: str, workspace_uid: str, /) Job#
Adds a job to a workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- Returns:
Successful Response
- Return type:
- load_input(project_uid: str, job_uid: str, input_name: str, /, *, force_join: bool | Literal['auto'] = 'auto', slots: Literal['default', 'passthrough', 'all'] | List[str] = 'default') Dataset#
Load job input dataset. Raises exception if no inputs are connected.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
force_join (bool | Literal['auto'], optional) – Defaults to ‘auto’
slots (Literal['default', 'passthrough', 'all'] | List[str], optional) – Defaults to ‘default’
- Returns:
A binary stream representing a Dataset class instance
- Return type:
- load_output(project_uid: str, job_uid: str, output_name: str, /, *, version: int | Literal['F'] = 'F', slots: Literal['default', 'passthrough', 'all'] | List[str] = 'default') Dataset#
Load job output dataset. Raises exception if output is empty or does not exists.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
version (int | Literal['F'], optional) – Set to F (default) to load the final version. Defaults to ‘F’
slots (Literal['default', 'passthrough', 'all'] | List[str], optional) – Defaults to ‘default’
- Returns:
A binary stream representing a Dataset class instance
- Return type:
- mark_completed(project_uid: str, job_uid: str, /) Job#
Mark a killed or failed job, or an active external job, as completed.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- mark_failed(project_uid: str, job_uid: str, /, *, error: str | None = None) Job#
Manually mark a job as failed.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
error (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- mark_running(project_uid: str, job_uid: str, /, *, status: Literal['running', 'waiting'] = 'running') Job#
Indicate that an external job is running or waiting.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
status (Literal['running', 'waiting'], optional) – Defaults to ‘running’
- Returns:
Successful Response
- Return type:
- move(project_uid: str, job_uid: str, /, *, from_workspace_uid: str, to_workspace_uid: str) Job#
Moves a job from one workspace to another.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
from_workspace_uid (str)
to_workspace_uid (str)
- Returns:
Successful Response
- Return type:
- recalculate_project_intermediate_results_size(project_uid: str, /) None#
Recaclulates intermediate result sizes for all jobs in a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- recalculate_size(project_uid: str, job_uid: str, /) Job#
Recalculates the size of a given job’s directory.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- recalculate_size_async(project_uid: str, job_uid: str, /) None#
For a job, find intermediate results and recalculate their total size.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- reconnect(project_uid: str, job_uid: str, input_name: str, connection_index: int, /, *, source_output_name: str, source_job_uid: str) Job#
Replace the connection at the given index with a new connection. Specify index -1 to replace the last connection.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str)
connection_index (int)
source_output_name (str)
source_job_uid (str)
- Returns:
Successful Response
- Return type:
- remove_tag(project_uid: str, job_uid: str, tag_uid: str, /) Job#
Removes the given tag a job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- save_output(project_uid: str, job_uid: str, output_name: str, /, dataset: Dataset, *, filename: str | None = None, version: int = 0) Job#
Save job output dataset. Job must be running or waiting.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
dataset (Dataset) – A binary stream representing a Dataset class instance
filename (str, optional) – Defaults to None
version (int, optional) – Defaults to 0
- Returns:
Successful Response
- Return type:
- set_cluster_custom_vars(project_uid: str, job_uid: str, /, cluster_custom_vars: Dict[str, str]) Job#
Sets cluster custom variables for job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
cluster_custom_vars (Dict[str, str])
- Returns:
Successful Response
- Return type:
- set_description(project_uid: str, job_uid: str, /, description: str) Job#
Sets job description.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
description (str)
- Returns:
Successful Response
- Return type:
- set_final_result(project_uid: str, job_uid: str, /, *, is_final_result: bool) Job#
Marks a job as a final result. A job marked as a final result and its ancestor jobs are protected during data cleanup.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
is_final_result (bool)
- Returns:
Successful Response
- Return type:
- set_output_image(project_uid: str, job_uid: str, output_name: str, /, body: GridFSAsset) Job#
Set a custom image for an External job output.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str)
body (GridFSAsset)
- Returns:
Successful Response
- Return type:
- set_param(project_uid: str, job_uid: str, param: str, /, value: Any) Job#
Sets the given job parameter to the value
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
param (str)
value (Any)
- Returns:
Successful Response
- Return type:
- set_priority(project_uid: str, job_uid: str, /, *, priority: int) Job#
Sets job priority
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
priority (int)
- Returns:
Successful Response
- Return type:
- set_tile_image(project_uid: str, job_uid: str, /, body: GridFSAsset) Job#
Set a custom job tile image for an External job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
body (GridFSAsset)
- Returns:
Successful Response
- Return type:
- set_title(project_uid: str, job_uid: str, /, *, title: str) Job#
Sets job title.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
title (str)
- Returns:
Successful Response
- Return type:
- star_job(project_uid: str, job_uid: str, /) Job#
Stars a job for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- unlink_from_workspace(project_uid: str, job_uid: str, workspace_uid: str, /) Job#
Removes a job from a workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- Returns:
Successful Response
- Return type:
- unstar_job(project_uid: str, job_uid: str, /) Job#
Unstars a job for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- update_directory_symlinks(project_uid: str, job_uid: str, /, *, prefix_cut: str, prefix_new: str) int#
Rewrites all symbolic links in the job directory, modifying links prefixed with prefix_cut to instead be prefixed with prefix_new.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
prefix_cut (str)
prefix_new (str)
- Returns:
Number of symlinks updated
- Return type:
int
- update_event_log(project_uid: str, job_uid: str, event_id: str = '000000000000000000000000', /, text: str | None = None, *, type: Literal['text', 'warning', 'error'] | None = None) TextEvent#
Update a text event log entry for a job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
event_id (str, optional) – Defaults to ‘000000000000000000000000’
text (str, optional) – Defaults to None
type (Literal['text', 'warning', 'error'], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- view(project_uid: str, workspace_uid: str, job_uid: str, /) Job#
Adds a project, workspace and job uid to a user’s recently viewed jobs list
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- class NotificationsAPI#
Functions available in
api.notifications, e.g.,api.notifications.deactivate_notification(...)Methods:
deactivate_notification(notification_id, /)Deactivates a notification
- deactivate_notification(notification_id: str, /) Notification#
Deactivates a notification
- Parameters:
notification_id (str)
- Returns:
Successful Response
- Return type:
- class ProjectsAPI#
Functions available in
api.projects, e.g.,api.projects.check_directory(...)Methods:
add_tag(project_uid, tag_uid, /)Tags a project with the given tag.
add_user_access(project_uid, user_id, /)Grants access to another user to view and edit the project.
archive(project_uid, /)Archives a project.
attach(*, path)Attaches a project directory at a specified path and writes a new lockfile.
check_directory(*, path)Checks if a candidate project directory exists, and if it is readable and writeable.
claim_all_instance_ownership(*[, force])Claims ownership of all projects in instance.
claim_instance_ownership(project_uid, /, *)cleanup_data(project_uid, /, *[, ...])Cleanup project or workspace data, clearing/deleting jobs based on final result status, sections, types, or job status
clear_default_param(project_uid, name, /)Clears the per-project default value for a parameter name.
clear_intermediate_results(project_uid, /, *)Removes intermediate results from the project.
count(*[, order, after, limit, uid, ...])Counts the number of projects matching the filter.
cp(project_uid, /, *, source[, path])Copy the source file or directory to the project directory at the given path.
create(*, title[, description])Creates a new project, project directory and creates a new document in the project collection
delete(project_uid, /)Starts project deletion task.
detach(project_uid, /)Detaches a project, removing its lockfile.
download_file(project_uid, /, *[, path])Download a file from the project directory at the given path.
find(*[, order, after, limit, uid, ...])Finds projects matching the filter.
find_one(project_uid, /)Finds a project by its UID
get_directory(project_uid, /)Gets the project's absolute directory with all environment variables in the path resolved
Gets intermediate result job types
Gets generate intermediate result settings.
get_job_register(project_uid, /)Gets the job register model for the project.
get_next_exposure_group_id(project_uid, /)Gets next exposure group ID
get_owner_id(project_uid, /)Get user account ID for the owner of a project.
get_symlinks(project_uid, /)Gets all symbolic links in the project directory
get_title_slug(*, title)Returns a slugified version of a project title.
ls(project_uid, /, *[, recursive, path])List files in the project directory.
mkdir(project_uid, /, *[, parents, ...])Create a directory in the project directory at the given path.
move(project_uid, /, *, path)Renames the project directory for a project.
preview_delete(project_uid, /)Retrieves the workspaces and jobs that would be affected when the project is deleted.
refresh_size(project_uid, /)Starts project size recalculation asynchronously.
remove_tag(project_uid, tag_uid, /)Removes the given tag from a project.
remove_user_access(project_uid, user_id, /)Removes a user's access from a project.
reset_autodump(project_uid, /)Clear project directory write failures.
set_default_param(project_uid, name, /, value)Sets a default value for a parameter name globally for the project
set_description(project_uid, /, description)Sets the description of a project.
Sets settings for intermediate result generation.
set_owner(project_uid, user_id, /)Sets owner of the project to the user
set_title(project_uid, /, *, title)Sets the title of a project.
star_project(project_uid, /)Stars a project for a user
symlink(project_uid, /, *, source[, path])Create a symlink from the source path in the project directory at the given path.
unarchive(project_uid, /, *, path)Reverses archive operation.
unstar_project(project_uid, /)Unstars a project for a user
upload_file(project_uid, /, stream, *[, ...])Upload a file to the project directory at the given path.
view(project_uid, /)Adds a project uid to a user's recently viewed projects list.
- add_tag(project_uid: str, tag_uid: str, /) Project#
Tags a project with the given tag.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- add_user_access(project_uid: str, user_id: str, /) Project#
Grants access to another user to view and edit the project. May only be called by project owners and administrators.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
user_id (str) – User ID or email
- Returns:
Successful Response
- Return type:
- archive(project_uid: str, /) None#
Archives a project. This means that the project can no longer be modified and jobs cannot be created or run. Once archived, the project directory may be safely moved to long-term storage.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- attach(*, path: str) Project#
Attaches a project directory at a specified path and writes a new lockfile. Must be run on a project directory without a lockfile.
- Parameters:
path (str)
- Returns:
Successful Response
- Return type:
- check_directory(*, path: str) str#
Checks if a candidate project directory exists, and if it is readable and writeable.
- Parameters:
path (str)
- Returns:
Successful Response
- Return type:
str
- claim_all_instance_ownership(*, force: bool = False) None#
Claims ownership of all projects in instance. Call when upgrading from an older CryoSPARC version that did not support project locks.
- Parameters:
force (bool, optional) – Defaults to False
- claim_instance_ownership(project_uid: str, /, *, force: bool = False) None#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
force (bool, optional) – Defaults to False
- cleanup_data(project_uid: str, /, *, workspace_uid: str | None = None, delete_non_final: bool = False, delete_statuses: List[Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']] = [], clear_non_final: bool = False, clear_categories: List[Literal['import', 'motion_correction', 'ctf_estimation', 'exposure_curation', 'particle_picking', 'extraction', 'deep_picker', 'particle_curation', 'reconstruction', 'refinement', 'ctf_refinement', 'variability', 'flexibility', 'postprocessing', 'local_refinement', 'helix', 'utilities', 'simulations', 'live', 'instance_testing', 'workflows']] = [], clear_types: List[str] = [], clear_statuses: List[Literal['building', 'queued', 'launched', 'started', 'running', 'waiting', 'completed', 'killed', 'failed']] = [], clear_preprocessing: bool = False) None#
Cleanup project or workspace data, clearing/deleting jobs based on final result status, sections, types, or job status
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str, optional) – Defaults to None
delete_non_final (bool, optional) – Defaults to False
delete_statuses (List[JobStatus], optional) – Defaults to []
clear_non_final (bool, optional) – Defaults to False
clear_categories (List[Category], optional) – Defaults to []
clear_types (List[str], optional) – Defaults to []
clear_statuses (List[JobStatus], optional) – Defaults to []
clear_preprocessing (bool, optional) – Defaults to False
- clear_default_param(project_uid: str, name: str, /) Project#
Clears the per-project default value for a parameter name.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
name (str)
- Returns:
Successful Response
- Return type:
- clear_intermediate_results(project_uid: str, /, *, always_keep_final: bool = True) None#
Removes intermediate results from the project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
always_keep_final (bool, optional) – Defaults to True
- count(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, project_dir: str | None = None, owner_user_id: str | None = None, users_with_access: List[str] | None = None, deleted: bool | None = False, archived: bool | None = None, detached: bool | None = None) int#
Counts the number of projects matching the filter.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
project_dir (str, optional) – Defaults to None
owner_user_id (str, optional) – Defaults to None
users_with_access (List[str], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
archived (bool, optional) – Defaults to None
detached (bool, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
int
- cp(project_uid: str, /, *, source: str, path: str = '') str#
Copy the source file or directory to the project directory at the given path. Returns the absolute path of the copied file.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
source (str)
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
str
- create(*, title: str, description: str | None = None, parent_dir: str) Project#
Creates a new project, project directory and creates a new document in the project collection
- Parameters:
title (str)
description (str, optional) – Defaults to None
parent_dir (str)
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, /) None#
Starts project deletion task. Will delete the project, its full directory, and all associated workspaces, sessions, jobs and results.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- detach(project_uid: str, /) None#
Detaches a project, removing its lockfile. This hides the project from the interface and allows other instances to attach and run this project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- download_file(project_uid: str, /, *, path: str = '') Stream#
Download a file from the project directory at the given path.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
A binary stream representing a Stream class instance
- Return type:
- find(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, project_dir: str | None = None, owner_user_id: str | None = None, users_with_access: List[str] | None = None, deleted: bool | None = False, archived: bool | None = None, detached: bool | None = None) List[Project]#
Finds projects matching the filter.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
project_dir (str, optional) – Defaults to None
owner_user_id (str, optional) – Defaults to None
users_with_access (List[str], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
archived (bool, optional) – Defaults to None
detached (bool, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[Project]
- find_one(project_uid: str, /) Project#
Finds a project by its UID
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- get_directory(project_uid: str, /) str#
Gets the project’s absolute directory with all environment variables in the path resolved
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
str
- get_generate_intermediate_results_job_types() List[str]#
Gets intermediate result job types
- Returns:
Successful Response
- Return type:
List[str]
- get_generate_intermediate_results_settings(project_uid: str, /) GenerateIntermediateResultsSettings#
Gets generate intermediate result settings.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- get_job_register(project_uid: str, /) JobRegister#
Gets the job register model for the project. The same for every project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- get_next_exposure_group_id(project_uid: str, /) int#
Gets next exposure group ID
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
int
- get_owner_id(project_uid: str, /) str#
Get user account ID for the owner of a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
str
- get_symlinks(project_uid: str, /) List[ProjectSymlink]#
Gets all symbolic links in the project directory
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
List[ProjectSymlink]
- get_title_slug(*, title: str) str#
Returns a slugified version of a project title.
- Parameters:
title (str)
- Returns:
Successful Response
- Return type:
str
- ls(project_uid: str, /, *, recursive: bool = False, path: str = '') List[str]#
List files in the project directory. Note that enabling recursive will include parent directories in the result.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
recursive (bool, optional) – Defaults to False
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
List[str]
- mkdir(project_uid: str, /, *, parents: bool = False, exist_ok: bool = False, path: str = '') str#
Create a directory in the project directory at the given path.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
parents (bool, optional) – Defaults to False
exist_ok (bool, optional) – Defaults to False
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
str
- move(project_uid: str, /, *, path: str) Project#
Renames the project directory for a project. Provide either the new directory name or the full new directory path.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str)
- Returns:
Successful Response
- Return type:
- preview_delete(project_uid: str, /) DeleteProjectPreview#
Retrieves the workspaces and jobs that would be affected when the project is deleted.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- refresh_size(project_uid: str, /) None#
Starts project size recalculation asynchronously.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- remove_tag(project_uid: str, tag_uid: str, /) Project#
Removes the given tag from a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- remove_user_access(project_uid: str, user_id: str, /) Project#
Removes a user’s access from a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
user_id (str) – User ID or email
- Returns:
Successful Response
- Return type:
- reset_autodump(project_uid: str, /) Project#
Clear project directory write failures. After calling this endpoint, CryoSPARC’s scheduler will attempt to write modified jobs and workspaces to the project directory that previously could not be saved.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- set_default_param(project_uid: str, name: str, /, value: bool | int | float | str) Project#
Sets a default value for a parameter name globally for the project
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
name (str)
value (bool | int | float | str)
- Returns:
Successful Response
- Return type:
- set_description(project_uid: str, /, description: str) Project#
Sets the description of a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
description (str)
- Returns:
Successful Response
- Return type:
- set_generate_intermediate_results_settings(project_uid: str, /, body: GenerateIntermediateResultsSettings) Project#
Sets settings for intermediate result generation.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- set_owner(project_uid: str, user_id: str, /) Project#
Sets owner of the project to the user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
user_id (str) – User ID or email
- Returns:
Successful Response
- Return type:
- set_title(project_uid: str, /, *, title: str) Project#
Sets the title of a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str)
- Returns:
Successful Response
- Return type:
- star_project(project_uid: str, /) Project#
Stars a project for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- symlink(project_uid: str, /, *, source: str, path: str = '') str#
Create a symlink from the source path in the project directory at the given path.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
source (str)
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
str
- unarchive(project_uid: str, /, *, path: str) Project#
Reverses archive operation.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str)
- Returns:
Successful Response
- Return type:
- unstar_project(project_uid: str, /) Project#
Unstars a project for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- upload_file(project_uid: str, /, stream: Stream, *, overwrite: bool = False, path: str = '') str#
Upload a file to the project directory at the given path. Returns absolute path of the uploaded file.
Path may be specified as a filename, a relative path inside the project directory, or a full absolute path.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
stream (Stream) – A binary stream representing a Stream class instance
overwrite (bool, optional) – Defaults to False
path (str, optional) – Relative path or absolute path within project directory. Defaults to ‘’
- Returns:
Successful Response
- Return type:
str
- class ResourcesAPI#
Functions available in
api.resources, e.g.,api.resources.find_lanes(...)Methods:
add_cluster(body)Adds a cluster or updates an existing cluster.
add_lane(body)Adds a new lane to the master scheduler.
add_node(body, *[, gpu])Adds a node or updates an existing node.
find_cluster(name, /)Finds a cluster with a given name.
find_cluster_script(name, /)Finds the cluster script for a cluster with a given name.
find_cluster_template_custom_vars(name, /)Computes and retrieves all custom variables names defined in cluster templates (i.e., all variables not in the internal list of known variable names).
find_cluster_template_vars(name, /)Computes and retrieves all variable names defined in cluster templates.
find_clusters(*[, lane])Finds a list of targets with type "cluster" that are registered with the master scheduler.
find_lane(name, /, *[, type])Finds a lane registered to the master scheduler with a given name and optional type.
Finds lanes that are registered with the master scheduler.
find_node(name, /)Finds a node with a given name.
find_nodes(*[, lane])Finds a list of targets with type "node" that are registered with the master scheduler.
find_target_by_hostname(hostname, /)Finds a target with a given hostname.
find_target_by_name(name, /)Finds a target with a given name.
find_targets(*[, lane])Finds a list of targets that are registered with the master scheduler.
Asynchronously access target worker nodes.
remove_cluster(name, /)Removes the specified cluster/lane and any targets assigned under the lane in the master scheduler
remove_lane(name, /)Removes the specified lane and any targets assigned under the lane in the master scheduler.
remove_node(name, /)Removes a target worker node from the master scheduler
update_cluster_custom_vars(name, /, value)Changes the custom cluster variables on the given target (assumed to exist)
update_node_lane(name, /, lane)Changes the lane on the given target (assumed to exist).
update_target_cache_path(name, /, value)Changes the cache path on the given target (assumed to exist)
verify_cluster(name, /)Ensures cluster has been properly configured by executing a generic 'info' command
- add_cluster(body: SchedulerTargetCluster) SchedulerTargetCluster#
Adds a cluster or updates an existing cluster. Updates existing cluster if they share share the same name.
- Parameters:
body (SchedulerTargetCluster)
- Returns:
Successful Response
- Return type:
- add_lane(body: SchedulerLane) SchedulerLane#
Adds a new lane to the master scheduler.
- Parameters:
body (SchedulerLane)
- Returns:
Successful Response
- Return type:
- add_node(body: SchedulerTargetNode, *, gpu: bool = True) SchedulerTargetNode#
Adds a node or updates an existing node. Updates existing node if they share share the same name. Attempts to connect to the node via SSH to run the
cryosparcw connectcommand.Set
gputo False to skip GPU detection.- Parameters:
body (SchedulerTargetNode)
gpu (bool, optional) – Defaults to True
- Returns:
Successful Response
- Return type:
- find_cluster(name: str, /) SchedulerTargetCluster#
Finds a cluster with a given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_cluster_script(name: str, /) str#
Finds the cluster script for a cluster with a given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
str
- find_cluster_template_custom_vars(name: str, /) List[str]#
Computes and retrieves all custom variables names defined in cluster templates (i.e., all variables not in the internal list of known variable names).
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
List[str]
- find_cluster_template_vars(name: str, /) List[str]#
Computes and retrieves all variable names defined in cluster templates.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
List[str]
- find_clusters(*, lane: str | None = None) List[SchedulerTargetCluster]#
Finds a list of targets with type “cluster” that are registered with the master scheduler. These are multi-node clusters managed by workflow managers like SLURM or PBS and are accessible via submission script.
- Parameters:
lane (str, optional) – Defaults to None
- Returns:
List of targets with type ‘cluster’
- Return type:
List[SchedulerTargetCluster]
- find_lane(name: str, /, *, type: Literal['node', 'cluster', None] | None = None) SchedulerLane#
Finds a lane registered to the master scheduler with a given name and optional type.
- Parameters:
name (str)
type (Literal['node', 'cluster', None], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- find_lanes() List[SchedulerLane]#
Finds lanes that are registered with the master scheduler.
- Returns:
List of lanes
- Return type:
List[SchedulerLane]
- find_node(name: str, /) SchedulerTargetNode#
Finds a node with a given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_nodes(*, lane: str | None = None) List[SchedulerTargetNode]#
Finds a list of targets with type “node” that are registered with the master scheduler. These correspond to discrete worker hostname accessible over SSH.
- Parameters:
lane (str, optional) – Defaults to None
- Returns:
List of targets with type ‘node’
- Return type:
List[SchedulerTargetNode]
- find_target_by_hostname(hostname: str, /) SchedulerTarget#
Finds a target with a given hostname.
- Parameters:
hostname (str)
- Returns:
Successful Response
- Return type:
- find_target_by_name(name: str, /) SchedulerTarget#
Finds a target with a given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_targets(*, lane: str | None = None) List[SchedulerTarget]#
Finds a list of targets that are registered with the master scheduler.
- Parameters:
lane (str, optional) – Defaults to None
- Returns:
List of targets
- Return type:
List[SchedulerTarget]
- refresh_nodes() None#
Asynchronously access target worker nodes. Load latest CPU, RAM and GPU info.
- remove_cluster(name: str, /) None#
Removes the specified cluster/lane and any targets assigned under the lane in the master scheduler
Note: This will remove any worker node associated with the specified cluster/lane.
- Parameters:
name (str)
- remove_lane(name: str, /) None#
Removes the specified lane and any targets assigned under the lane in the master scheduler.
- Parameters:
name (str)
- remove_node(name: str, /) None#
Removes a target worker node from the master scheduler
- Parameters:
name (str)
- update_cluster_custom_vars(name: str, /, value: Dict[str, str]) SchedulerTargetCluster#
Changes the custom cluster variables on the given target (assumed to exist)
- Parameters:
name (str)
value (Dict[str, str])
- Returns:
Successful Response
- Return type:
- update_node_lane(name: str, /, lane: str) SchedulerTargetNode#
Changes the lane on the given target (assumed to exist). Target type must match lane type.
- Parameters:
name (str)
lane (str)
- Returns:
Successful Response
- Return type:
- update_target_cache_path(name: str, /, value: str | None) SchedulerTarget#
Changes the cache path on the given target (assumed to exist)
- Parameters:
name (str)
value (str | None)
- Returns:
Successful Response
- Return type:
- verify_cluster(name: str, /) str#
Ensures cluster has been properly configured by executing a generic ‘info’ command
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
str
- class SessionsAPI#
Functions available in
api.sessions, e.g.,api.sessions.find(...)Methods:
add_tag(project_uid, session_uid, tag_uid, /)Tags a session with the given tag.
apply_configuration_profile(project_uid, ...)Applies a configuration profile to a session, overwriting its resources, parameters, and exposure group
clear_phase2_abinit(project_uid, session_uid, /)Clears Ab-Initio Reconstruction job for a session
clear_phase2_class2D(project_uid, session_uid, /)Clears streaming 2D Classification job for a session
clear_phase2_refine(project_uid, session_uid, /)Clears streaming Homogenous Refinement job for a session
clear_session(project_uid, session_uid, /)Deletes all file engine documents (removing all previously known files and max timestamps), all Phase 1 Worker jobs and all associated exposure documents.
clear_template_creation_class2D(project_uid, ...)Clears template creation class2D job for a session
clone(project_uid, session_uid, /, *[, ...])Clones an existing session, copying session configuration, parameters, and exposure groups.
compact_session(project_uid, session_uid, /)Compacts a session by clearing each exposure group and its related files for each exposure in the session.
configure_auto_pause(project_uid, ...[, ...])count(*[, order, after, limit, uid, ...])Counts all sessions in a project
create(project_uid, /, *, title[, ...])Creates a new session
create_and_enqueue_export_exposures(...[, ...])Creates and enqueues a Live Exposure Export job for a session
create_and_enqueue_export_particles(...[, ...])Creates and enqueues a Live Particle Export job for a session
Creates a session configuration profile
create_exposure_group(project_uid, ...)Creates an exposure group for a session.
delete(project_uid, session_uid, /)Sets the session document as "deleted" Will throw an error if any undeleted jobs exist within the session.
delete_configuration_profile(configuration_id, /)Deletes a configuration profile
delete_exposure_group(project_uid, ...)Deletes an exposure group from a session.
enqueue_phase2_abinit(project_uid, ...)Enqueues Ab-Initio Reconstruction job for a session
enqueue_phase2_class2D(project_uid, ...)Enqueues streaming 2D Classification job for a session
enqueue_phase2_refine(project_uid, ...)Enqueues a streaming Homogenous Refinement job for a session
export_session(project_uid, session_uid, /, *)Writes session results, including all exposures and particles, to the project exports directory.
finalize_exposure_group(project_uid, ...)Finalizes an exposure group.
find(*[, order, after, limit, uid, ...])Lists all sessions (optionally, in a project)
find_exposure_group(project_uid, ...)Finds an exposure group with a specific id for a session.
find_exposure_groups(project_uid, session_uid, /)Finds all exposure groups in a session.
find_one(project_uid, session_uid, /)Finds a session
Gets all session configuration profiles
Gets base session parameters
mark_session_completed(project_uid, ...)Marks the session as completed
pause(project_uid, session_uid, /)Pauses a CryoSPARC Live Session.
reinitialize_phase2_class2D(project_uid, ...)Setup streaming 2D classification job for a session.
remove_tag(project_uid, session_uid, tag_uid, /)Removes the given tag from a session.
reset_all_attribute_thresholds(project_uid, ...)Resets all attribute thresholds for a session
reset_attribute_threshold(project_uid, ...)Resets attribute threshold for a session
restore_session(project_uid, session_uid, /, ...)Restores exposures of a compacted session.
select_all_class2d_templates(project_uid, ...)Sets all templates in the session's streaming 2D Classification job
select_all_picking_templates(project_uid, ...)Selects or deselects all templates for a template creation job in a session
Sets all templates above or below an index for a session's streaming 2D Classification
Selects all templates above or below an index in a template creation job for a session
select_phase2_abinit_volume(project_uid, ...)Selects a volume for an Ab-Initio Reconstruction job in a session
Selects all templates above or below an index in a template creation job for a session
Selects all templates above or below an index in a template creation job for a session
set_phase2_abinit_job(project_uid, ...)Sets a Live Ab-Initio Reconstruction job for the session.
Sets session exposure processing priority
Sets whether to wait until exposures are available before queuing the session's preprocessing worker jobs.
set_template_creation_job(project_uid, ...)Set template creation class2D job for a session
setup_phase2_abinit(project_uid, session_uid, /)Setup Ab-Initio Reconstruction job for a session
setup_phase2_class2D(project_uid, session_uid, /)Setup streaming 2D classification job for a session.
setup_phase2_refine(project_uid, session_uid, /)setup_template_creation_class2D(project_uid, ...)Setup template creation class2D job for a session
star_session(project_uid, session_uid, /)Stars a session for a user
start(project_uid, session_uid, /)Builds and starts a CryoSPARC Live Session.
start_extract_manual(project_uid, session_uid, /)Extracts manual picks from a session
stop_phase2_abinit(project_uid, session_uid, /)Stops an Ab-Initio Reconstruction job for a session.
stop_phase2_class2D(project_uid, session_uid, /)Stops streaming 2D Classification job for a session
stop_phase2_refine(project_uid, session_uid, /)Stops a streaming Homogenous Refinement job for a session
toggle_all_class2d_templates(project_uid, ...)Inverts all templates for a session's streaming 2D classification job
toggle_all_picking_templates(project_uid, ...)Toggles templates for all templates for a session's template creation job
toggle_class2d_template(project_uid, ...)Inverts selected template for the streaming 2D Classification job of a job
toggle_picking_template(project_uid, ...)Toggles template for template creation job at a specific index for a session's template creation job
unstar_session(project_uid, session_uid, /)Stars a session for a user
update_attribute_threshold(project_uid, ...)Updates thresholds for a given attribute.
update_compute_configuration(project_uid, ...)Updates compute configuration for a session.
Updates a configuration profile
update_exposure_group(project_uid, ...)Updates properties of an exposure group.
update_phase2_abinit_params(project_uid, ...)Updates Ab-Initio Reconstruction parameters for the session
update_phase2_class2D_params(project_uid, ...)Updates streaming 2D Classification job params for session
update_phase2_refine_params(project_uid, ...)Updates parameters for a streaming Homogenous Refinement job for a session
update_picking_threshold_values(project_uid, ...)Updates picking threshold values for a session
update_session_params(project_uid, ...[, ...])Updates a session's params.
view(project_uid, session_uid, /)Adds a project, workspace and job uid to a user's recently viewed sessions list
- add_tag(project_uid: str, session_uid: str, tag_uid: str, /) Session#
Tags a session with the given tag.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- apply_configuration_profile(project_uid: str, session_uid: str, /, *, configuration_id: str) Session#
Applies a configuration profile to a session, overwriting its resources, parameters, and exposure group
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
configuration_id (str)
- Returns:
Successful Response
- Return type:
- clear_phase2_abinit(project_uid: str, session_uid: str, /) Session#
Clears Ab-Initio Reconstruction job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- clear_phase2_class2D(project_uid: str, session_uid: str, /) Session#
Clears streaming 2D Classification job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- clear_phase2_refine(project_uid: str, session_uid: str, /) Session#
Clears streaming Homogenous Refinement job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- clear_session(project_uid: str, session_uid: str, /) Session#
Deletes all file engine documents (removing all previously known files and max timestamps), all Phase 1 Worker jobs and all associated exposure documents.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- clear_template_creation_class2D(project_uid: str, session_uid: str, /) Session#
Clears template creation class2D job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- clone(project_uid: str, session_uid: str, /, *, title: str | None = None, description: str | None = None, created_by_job_uid: str | None = None) Session#
Clones an existing session, copying session configuration, parameters, and exposure groups.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
title (str, optional) – Defaults to None
description (str, optional) – Defaults to None
created_by_job_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- compact_session(project_uid: str, session_uid: str, /) None#
Compacts a session by clearing each exposure group and its related files for each exposure in the session. Also clears gridfs data.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- configure_auto_pause(project_uid: str, session_uid: str, /, *, auto_pause: Literal['disabled', 'graceful', 'immediate'], auto_pause_after_idle_minutes: int = 10) Session#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
auto_pause (Literal['disabled', 'graceful', 'immediate'])
auto_pause_after_idle_minutes (int, optional) – Defaults to 10
- Returns:
Successful Response
- Return type:
- count(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, session_uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, cleared_at: Tuple[datetime, datetime] | None = None, status: List[Literal['paused', 'running', 'completed', 'compacting', 'compacted', 'restoring', 'restoration_failed']] | None = None, deleted: bool | None = False) int#
Counts all sessions in a project
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
session_uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
cleared_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
status (List[SessionStatus], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
int
- create(project_uid: str, /, *, title: str, description: str | None = None, created_by_job_uid: str | None = None) Session#
Creates a new session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str)
description (str, optional) – Defaults to None
created_by_job_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- create_and_enqueue_export_exposures(project_uid: str, session_uid: str, /, *, export_ignored: bool = False) Job#
Creates and enqueues a Live Exposure Export job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
export_ignored (bool, optional) – Defaults to False
- Returns:
Enqueued Live Exposure Export job
- Return type:
- create_and_enqueue_export_particles(project_uid: str, session_uid: str, /, *, picker_type: Literal['blob', 'template', 'manual'] | None = None, num_mics: int | None = None, uid_lte: int | None = None, test_only: bool = False) Job#
Creates and enqueues a Live Particle Export job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
picker_type (Literal['blob', 'template', 'manual'], optional) – Defaults to None
num_mics (int, optional) – Defaults to None
uid_lte (int, optional) – Defaults to None
test_only (bool, optional) – Defaults to False
- Returns:
Enqueued export particles job
- Return type:
- create_configuration_profile(body: SessionConfigProfileBody) SessionConfigProfile#
Creates a session configuration profile
- Parameters:
body (SessionConfigProfileBody)
- Returns:
Successful Response
- Return type:
- create_exposure_group(project_uid: str, session_uid: str, /) ExposureGroup#
Creates an exposure group for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, session_uid: str, /) None#
Sets the session document as “deleted” Will throw an error if any undeleted jobs exist within the session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- delete_configuration_profile(configuration_id: str, /) None#
Deletes a configuration profile
- Parameters:
configuration_id (str)
- delete_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) Session#
Deletes an exposure group from a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_group_id (int)
- Returns:
Successful Response
- Return type:
- enqueue_phase2_abinit(project_uid: str, session_uid: str, /) Job#
Enqueues Ab-Initio Reconstruction job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- enqueue_phase2_class2D(project_uid: str, session_uid: str, /) Job#
Enqueues streaming 2D Classification job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- enqueue_phase2_refine(project_uid: str, session_uid: str, /) Job#
Enqueues a streaming Homogenous Refinement job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- export_session(project_uid: str, session_uid: str, /, *, export_movies: bool = False, export_ignored_exposures: bool = False, picker_type: Literal['blob', 'template', 'manual'] | None = None) None#
Writes session results, including all exposures and particles, to the project exports directory. The resulting directory contains .csg files. Copy the directory to another CryoSPARC project (while resolving symlinks) and import individual .csg files with the Import Result Group job.
Example copy command:
mkdir -p /path/to/projects/cs-project-b/imports/ cp -rL /path/to/projects/cs-project-a/exports/S1 /path/to/projects/cs-project-b/imports/
Note: the original movies are not added to the export directory by default.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
export_movies (bool, optional) – Defaults to False
export_ignored_exposures (bool, optional) – Defaults to False
picker_type (Literal['blob', 'template', 'manual'], optional) – Defaults to None
- finalize_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) ExposureGroup#
Finalizes an exposure group.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_group_id (int)
- Returns:
Successful Response
- Return type:
- find(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, session_uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, cleared_at: Tuple[datetime, datetime] | None = None, status: List[Literal['paused', 'running', 'completed', 'compacting', 'compacted', 'restoring', 'restoration_failed']] | None = None, deleted: bool | None = False) List[Session]#
Lists all sessions (optionally, in a project)
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
session_uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
cleared_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
status (List[SessionStatus], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
List[Session]
- find_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) ExposureGroup#
Finds an exposure group with a specific id for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_group_id (int)
- Returns:
Successful Response
- Return type:
- find_exposure_groups(project_uid: str, session_uid: str, /) List[ExposureGroup]#
Finds all exposure groups in a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
List[ExposureGroup]
- find_one(project_uid: str, session_uid: str, /) Session#
Finds a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- get_configuration_profiles() List[SessionConfigProfile]#
Gets all session configuration profiles
- Returns:
Successful Response
- Return type:
List[SessionConfigProfile]
- get_session_base_params() Any#
Gets base session parameters
- Returns:
Successful Response
- Return type:
Any
- mark_session_completed(project_uid: str, session_uid: str, /) Session#
Marks the session as completed
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- pause(project_uid: str, session_uid: str, /) Session#
Pauses a CryoSPARC Live Session. Gracefully stops and kills all phase one workers, file engines and phase two jobs
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- reinitialize_phase2_class2D(project_uid: str, session_uid: str, /) Job#
Setup streaming 2D classification job for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- remove_tag(project_uid: str, session_uid: str, tag_uid: str, /) Session#
Removes the given tag from a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- reset_all_attribute_thresholds(project_uid: str, session_uid: str, /) Session#
Resets all attribute thresholds for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- reset_attribute_threshold(project_uid: str, session_uid: str, attribute: str, /) Session#
Resets attribute threshold for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
attribute (str)
- Returns:
Successful Response
- Return type:
- restore_session(project_uid: str, session_uid: str, /, body: LiveComputeResources) None#
Restores exposures of a compacted session. Starts phase 1 worker(s) on the specified lane to restore each exposure by re-processing starting from motion correction, skipping the picking stage.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LiveComputeResources)
- select_all_class2d_templates(project_uid: str, session_uid: str, direction: Literal['select', 'deselect'], /) Session#
Sets all templates in the session’s streaming 2D Classification job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
direction (Literal['select', 'deselect'])
- Returns:
Successful Response
- Return type:
- select_all_picking_templates(project_uid: str, session_uid: str, direction: Literal['select', 'deselect'], /) Session#
Selects or deselects all templates for a template creation job in a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
direction (Literal['select', 'deselect'])
- Returns:
Successful Response
- Return type:
- select_class2d_templates_with_threshold_index(project_uid: str, session_uid: str, template_idx: int, /, *, dimension: Literal['num_particles_total', 'res_A', 'class_ess'], direction: Literal['above', 'below'] = 'above') Session#
Sets all templates above or below an index for a session’s streaming 2D Classification
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_idx (int)
dimension (Literal['num_particles_total', 'res_A', 'class_ess'])
direction (Literal['above', 'below'], optional) – Defaults to ‘above’
- Returns:
Successful Response
- Return type:
- select_class2d_templates_with_thresholds(project_uid: str, session_uid: str, /, template_selection_thresholds: List[TemplateSelectionThreshold]) Session#
Selects all templates above or below an index in a template creation job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_selection_thresholds (List[TemplateSelectionThreshold])
- Returns:
Successful Response
- Return type:
- select_phase2_abinit_volume(project_uid: str, session_uid: str, /, *, volume_name: str) Session#
Selects a volume for an Ab-Initio Reconstruction job in a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
volume_name (str)
- Returns:
Successful Response
- Return type:
- select_picking_templates_with_threshold_index(project_uid: str, session_uid: str, template_idx: int, direction: Literal['above', 'below'], /, *, dimension: Literal['num_particles_total', 'res_A', 'class_ess']) Session#
Selects all templates above or below an index in a template creation job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_idx (int)
direction (Literal['above', 'below'])
dimension (Literal['num_particles_total', 'res_A', 'class_ess'])
- Returns:
Successful Response
- Return type:
- select_picking_templates_with_thresholds(project_uid: str, session_uid: str, /, template_selection_thresholds: List[TemplateSelectionThreshold]) Session#
Selects all templates above or below an index in a template creation job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_selection_thresholds (List[TemplateSelectionThreshold])
- Returns:
Successful Response
- Return type:
- set_phase2_abinit_job(project_uid: str, session_uid: str, /, *, job_uid: str) Session#
Sets a Live Ab-Initio Reconstruction job for the session. May specify any job with volume outputs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
job_uid (str)
- Returns:
Successful Response
- Return type:
- set_session_exposure_processing_priority(project_uid: str, session_uid: str, /, *, exposure_processing_priority: Literal['normal', 'oldest', 'latest', 'alternate']) Session#
Sets session exposure processing priority
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_processing_priority (Literal['normal', 'oldest', 'latest', 'alternate'])
- Returns:
Successful Response
- Return type:
- set_session_phase_one_wait_for_exposures(project_uid: str, session_uid: str, /, *, phase_one_wait_for_exposures: bool) Session#
Sets whether to wait until exposures are available before queuing the session’s preprocessing worker jobs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
phase_one_wait_for_exposures (bool)
- Returns:
Successful Response
- Return type:
- set_template_creation_job(project_uid: str, session_uid: str, /, *, job_uid: str, template_creation_project_uid: str | None = None) Session#
Set template creation class2D job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
job_uid (str)
template_creation_project_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- setup_phase2_abinit(project_uid: str, session_uid: str, /) Job#
Setup Ab-Initio Reconstruction job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- setup_phase2_class2D(project_uid: str, session_uid: str, /) Job#
Setup streaming 2D classification job for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- setup_phase2_refine(project_uid: str, session_uid: str, /) Job#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- setup_template_creation_class2D(project_uid: str, session_uid: str, /, *, num_classes: int, picker_type: Literal['blob', 'template', 'manual'], num_mics: int, override_particle_diameter_A: float | None = None, uid_lte: int | None = None) Job#
Setup template creation class2D job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
num_classes (int)
picker_type (Literal['blob', 'template', 'manual'])
num_mics (int)
override_particle_diameter_A (float, optional) – Defaults to None
uid_lte (int, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- star_session(project_uid: str, session_uid: str, /) Session#
Stars a session for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- start(project_uid: str, session_uid: str, /) Session#
Builds and starts a CryoSPARC Live Session. Builds file engines based on file engine parameters in the session doc, builds phase one workers based on lane parameters in the session doc.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- start_extract_manual(project_uid: str, session_uid: str, /) None#
Extracts manual picks from a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- stop_phase2_abinit(project_uid: str, session_uid: str, /) Session#
Stops an Ab-Initio Reconstruction job for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- stop_phase2_class2D(project_uid: str, session_uid: str, /) Session#
Stops streaming 2D Classification job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- stop_phase2_refine(project_uid: str, session_uid: str, /) Session#
Stops a streaming Homogenous Refinement job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- toggle_all_class2d_templates(project_uid: str, session_uid: str, /) Session#
Inverts all templates for a session’s streaming 2D classification job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- toggle_all_picking_templates(project_uid: str, session_uid: str, /) Session#
Toggles templates for all templates for a session’s template creation job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- toggle_class2d_template(project_uid: str, session_uid: str, template_idx: int, /) Session#
Inverts selected template for the streaming 2D Classification job of a job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_idx (int)
- Returns:
Successful Response
- Return type:
- toggle_picking_template(project_uid: str, session_uid: str, template_idx: int, /) Session#
Toggles template for template creation job at a specific index for a session’s template creation job
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
template_idx (int)
- Returns:
Successful Response
- Return type:
- unstar_session(project_uid: str, session_uid: str, /) Session#
Stars a session for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- update_attribute_threshold(project_uid: str, session_uid: str, attribute: str, /, *, min_val: float | None = None, max_val: float | None = None) Session#
Updates thresholds for a given attribute.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
attribute (str)
min_val (float, optional) – Defaults to None
max_val (float, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- update_compute_configuration(project_uid: str, session_uid: str, /, body: LiveComputeResources) LiveComputeResources#
Updates compute configuration for a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LiveComputeResources)
- Returns:
Successful Response
- Return type:
- update_configuration_profile(configuration_id: str, /, body: SessionConfigProfileBody) SessionConfigProfile#
Updates a configuration profile
- Parameters:
configuration_id (str)
body (SessionConfigProfileBody)
- Returns:
Successful Response
- Return type:
- update_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /, body: ExposureGroupUpdate) ExposureGroup#
Updates properties of an exposure group.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
exposure_group_id (int)
body (ExposureGroupUpdate)
- Returns:
Successful Response
- Return type:
- update_phase2_abinit_params(project_uid: str, session_uid: str, /, body: LiveAbinitParams) Session#
Updates Ab-Initio Reconstruction parameters for the session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LiveAbinitParams)
- Returns:
Successful Response
- Return type:
- update_phase2_class2D_params(project_uid: str, session_uid: str, /, body: LiveClass2DParams) Session#
Updates streaming 2D Classification job params for session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LiveClass2DParams)
- Returns:
Successful Response
- Return type:
- update_phase2_refine_params(project_uid: str, session_uid: str, /, body: LiveRefineParams) Session#
Updates parameters for a streaming Homogenous Refinement job for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LiveRefineParams)
- Returns:
Successful Response
- Return type:
- update_picking_threshold_values(project_uid: str, session_uid: str, picker_type: Literal['blob', 'template', 'deep'], /, *, ncc_value: float, power_min_value: float, power_max_value: float) Session#
Updates picking threshold values for a session
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
picker_type (Literal['blob', 'template', 'deep'])
ncc_value (float)
power_min_value (float)
power_max_value (float)
- Returns:
Successful Response
- Return type:
- update_session_params(project_uid: str, session_uid: str, /, body: LivePreprocessingParams, *, reprocess: bool = True, priority: int = 1) Session#
Updates a session’s params. Updates each exposure inside the session with the new stage to start processing at (if there is one).
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
body (LivePreprocessingParams)
reprocess (bool, optional) – Defaults to True
priority (int, optional) – Defaults to 1
- Returns:
Successful Response
- Return type:
- class TagsAPI#
Functions available in
api.tags, e.g.,api.tags.find(...)Methods:
create(*, type[, colour, description, ...])Creates a new tag
delete(tag_uid, /)Deletes a given tag
find(*[, order, after, limit, ...])Finds tags that match the given query.
Gets a count of all tags by type
Gets all tags as a dictionary, where the types are the keys
update(tag_uid, /, *[, colour, description])Updates the title, colour and/or description of the given tag UID
- create(*, type: Literal['general', 'project', 'workspace', 'session', 'job'], colour: Literal['black', 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'purple', 'pink'] | None = None, description: str | None = None, created_by_workflow: str | None = None, title: str | None) Tag#
Creates a new tag
- Parameters:
type (Literal['general', 'project', 'workspace', 'session', 'job'])
colour (Literal['black', 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'purple', 'pink'], optional) – Defaults to None
description (str, optional) – Defaults to None
created_by_workflow (str, optional) – Defaults to None
title (str | None)
- Returns:
Successful Response
- Return type:
- delete(tag_uid: str, /) None#
Deletes a given tag
- Parameters:
tag_uid (str)
- find(*, order: int = 1, after: str | None = None, limit: int = 100, created_by_user_id: str | None = None, type: List[Literal['general', 'project', 'workspace', 'session', 'job']] | None = None, uid: str | None = None) List[Tag]#
Finds tags that match the given query.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
created_by_user_id (str, optional) – Defaults to None
type (List[Literal['general', 'project', 'workspace', 'session', 'job']], optional) – Defaults to None
uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[Tag]
- get_tag_count_by_type() Dict[str, int]#
Gets a count of all tags by type
- Returns:
Successful Response
- Return type:
Dict[str, int]
- get_tags_by_type() Dict[str, List[Tag]]#
Gets all tags as a dictionary, where the types are the keys
- Returns:
Successful Response
- Return type:
Dict[str, List[Tag]]
- update(tag_uid: str, /, *, colour: Literal['black', 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'purple', 'pink'] | None = None, description: str | None = None, title: str | None) Tag#
Updates the title, colour and/or description of the given tag UID
- Parameters:
tag_uid (str)
colour (Literal['black', 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'purple', 'pink'], optional) – Defaults to None
description (str, optional) – Defaults to None
title (str | None)
- Returns:
Successful Response
- Return type:
- class UsersAPI#
Functions available in
api.users, e.g.,api.users.admin_exists(...)Methods:
Returns True if there exists at least one user with admin privileges, False otherwise
count(*[, role])create([password, role])Creates a new CryoSPARC user account.
delete(user_id, /)Removes a user from the CryoSPARC.
find_one(user_id, /)Finds a user with a matching user ID or email
get_file_browser_settings(user_id, /)get_lanes(user_id, /)Gets the lane names a user has access to
get_my_state_var(key, /)Retrieves a user's state variable such as "licenseAccepted" or "recentProjects"
get_role(user_id, /)Returns "admin" if the user has admin privileges, "user" otherwise.
get_state_var(user_id, key, /)Retrieves a given user's state variable such as "licenseAccepted" or "recentProjects"
me()Returns the current user
register(user_id, /, body, *, token)Registers user with a token (unauthenticated).
request_reset_password(user_id, /)Generates a password reset token for a user with the given email.
reset_password(user_id, /, body, *, token)Resets password function with a token (unauthenticated).
set_file_browser_settings(user_id, /, body)set_lanes(user_id, /, lanes)Restrict lanes the given user ID may to queue to.
set_role(user_id, /, role)Changes a user's from between "user" and "admin".
set_state_var(user_id, key, /, value)Sets a property of the user's state
table()Show a table of all CryoSPARC user accounts
unset_state_var(user_id, key, /)Deletes a property of the user's state
update(user_id, /, *[, email, username, ...])Updates a user's general details.
- admin_exists() bool#
Returns True if there exists at least one user with admin privileges, False otherwise
- Returns:
Successful Response
- Return type:
bool
- count(*, role: Literal['user', 'admin'] | None = None) int#
- Parameters:
role (Literal['user', 'admin'], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
int
- create(password: SHA256Password | None = None, *, email: str, username: str, first_name: str, last_name: str, role: Literal['user', 'admin'] = 'user') User#
Creates a new CryoSPARC user account. Specify
created_by_user_idas the id of user who is creating the new user.The password is expected as a SHA256 hash.
- Parameters:
password (SHA256Password, optional) – Defaults to None
email (str)
username (str)
first_name (str)
last_name (str)
role (Literal['user', 'admin'], optional) – Defaults to ‘user’
- Returns:
Successful Response
- Return type:
- delete(user_id: str, /) None#
Removes a user from the CryoSPARC. Only authenticated admins may do this.
- Parameters:
user_id (str) – User ID or Email Address
- find_one(user_id: str, /) User#
Finds a user with a matching user ID or email
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
Successful Response
- Return type:
- get_file_browser_settings(user_id: str, /) FileBrowserPrefixes#
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
User file browser settings
- Return type:
- get_lanes(user_id: str, /) List[str]#
Gets the lane names a user has access to
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
Successful Response
- Return type:
List[str]
- get_my_state_var(key: str, /) Any#
Retrieves a user’s state variable such as “licenseAccepted” or “recentProjects”
- Parameters:
key (str)
- Returns:
Successful Response
- Return type:
Any
- get_role(user_id: str, /) Literal['user', 'admin']#
Returns “admin” if the user has admin privileges, “user” otherwise.
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
Successful Response
- Return type:
Literal[‘user’, ‘admin’]
- get_state_var(user_id: str, key: str, /) Any#
Retrieves a given user’s state variable such as “licenseAccepted” or “recentProjects”
- Parameters:
user_id (str) – User ID or Email Address
key (str)
- Returns:
Successful Response
- Return type:
Any
- register(user_id: str, /, body: SHA256Password, *, token: str) None#
Registers user with a token (unauthenticated).
- Parameters:
user_id (str) – User ID or Email Address
body (SHA256Password)
token (str)
- request_reset_password(user_id: str, /) None#
Generates a password reset token for a user with the given email. The token will appear in the Admin > User Management interface.
- Parameters:
user_id (str) – User ID or Email Address
- reset_password(user_id: str, /, body: SHA256Password, *, token: str) None#
Resets password function with a token (unauthenticated). password is expected as a sha256 hash.
- Parameters:
user_id (str) – User ID or Email Address
body (SHA256Password)
token (str)
- set_file_browser_settings(user_id: str, /, body: FileBrowserPrefixes) User#
- Parameters:
user_id (str) – User ID or Email Address
body (FileBrowserPrefixes)
- Returns:
Successful Response
- Return type:
- set_lanes(user_id: str, /, lanes: List[str]) User#
Restrict lanes the given user ID may to queue to. Only admins and account owners may access this function.
- Parameters:
user_id (str) – User ID or Email Address
lanes (List[str])
- Returns:
Updated user
- Return type:
- set_role(user_id: str, /, role: Literal['user', 'admin']) User#
Changes a user’s from between “user” and “admin”. Only admins may do this. This revokes all access tokens for the given used ID.
- Parameters:
user_id (str) – User ID or Email Address
role (Literal['user', 'admin'])
- Returns:
Successful Response
- Return type:
- set_state_var(user_id: str, key: str, /, value: Any) User#
Sets a property of the user’s state
- Parameters:
user_id (str) – User ID or Email Address
key (str)
value (Any)
- Returns:
Successful Response
- Return type:
- table() str#
Show a table of all CryoSPARC user accounts
- Returns:
Successful Response
- Return type:
str
- unset_state_var(user_id: str, key: str, /) User#
Deletes a property of the user’s state
- Parameters:
user_id (str) – User ID or Email Address
key (str)
- Returns:
Successful Response
- Return type:
- update(user_id: str, /, *, email: str | None = None, username: str | None = None, first_name: str | None = None, last_name: str | None = None) User#
Updates a user’s general details. other params will only be set if they are not empty.
- Parameters:
user_id (str) – User ID or Email Address
email (str, optional) – Defaults to None
username (str, optional) – Defaults to None
first_name (str, optional) – Defaults to None
last_name (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- class WorkflowsAPI#
Functions available in
api.workflows, e.g.,api.workflows.create_workflow(...)Methods:
apply_workflow(workflow_id, /, schema)For cryosparc app only
create_workflow(schema, *, workflow_id[, ...])For cryosparc app only
delete_workflow(workflow_id, /)For cryosparc app only
edit_workflow(workflow_id, /, schema)For cryosparc app only
- apply_workflow(workflow_id: str, /, schema: Dict[str, Any]) None#
For cryosparc app only
- Parameters:
workflow_id (str)
schema (Dict[str, Any])
- create_workflow(schema: Dict[str, Any], *, workflow_id: str, forked: bool = False, imported: bool = False, rebuilt: bool = False) None#
For cryosparc app only
- Parameters:
schema (Dict[str, Any])
workflow_id (str)
forked (bool, optional) – Defaults to False
imported (bool, optional) – Defaults to False
rebuilt (bool, optional) – Defaults to False
- delete_workflow(workflow_id: str, /) None#
For cryosparc app only
- Parameters:
workflow_id (str)
- edit_workflow(workflow_id: str, /, schema: Dict[str, Any]) None#
For cryosparc app only
- Parameters:
workflow_id (str)
schema (Dict[str, Any])
- class WorkspacesAPI#
Functions available in
api.workspaces, e.g.,api.workspaces.find(...)Methods:
add_tag(project_uid, workspace_uid, tag_uid, /)Tag the given workspace with the given tag.
clear_intermediate_results(project_uid, ...)Remove intermediate results from a workspace.
count(*[, order, after, limit, uid, ...])Count all workspaces.
create(project_uid, /, *, title[, ...])Create a new workspace
delete(project_uid, workspace_uid, /)Marks the workspace as "deleted".
find(*[, order, after, limit, uid, ...])List all workspaces.
find_one(project_uid, workspace_uid, /)Find a specific workspace in a project
find_workspace_ancestor_uids(project_uid, ...)Finds ancestors of the given jobs in the workspace.
find_workspace_descendant_uids(project_uid, ...)Finds descendants of jobs in the workspace
preview_delete(project_uid, workspace_uid, /)Get a list of jobs that would be removed when the given workspace is deleted.
remove_tag(project_uid, workspace_uid, ...)Removes a tag from a workspace.
set_description(project_uid, workspace_uid, ...)Set description of a workspace
set_title(project_uid, workspace_uid, /, *, ...)Set title of a workspace
star_workspace(project_uid, workspace_uid, /)Stars a workspace for a user
unstar_workspace(project_uid, workspace_uid, /)Unstars a workspace for a user
view(project_uid, workspace_uid, /)Adds a workspace uid to a user's recently viewed workspaces list.
- add_tag(project_uid: str, workspace_uid: str, tag_uid: str, /) Workspace#
Tag the given workspace with the given tag.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- clear_intermediate_results(project_uid: str, workspace_uid: str, /, *, always_keep_final: bool = False) None#
Remove intermediate results from a workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
always_keep_final (bool, optional) – Defaults to False
- count(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, deleted: bool | None = False) int#
Count all workspaces. Use a query to count workspaces in a specific project.
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
int
- create(project_uid: str, /, *, title: str, description: str | None = None, created_by_job_uid: str | None = None) Workspace#
Create a new workspace
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str)
description (str, optional) – Defaults to None
created_by_job_uid (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, workspace_uid: str, /) None#
Marks the workspace as “deleted”. Deletes jobs that are only linked to this workspace and no other workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- find(*, order: int = 1, after: str | None = None, limit: int = 100, uid: List[str] | None = None, project_uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, deleted: bool | None = False) List[Workspace]#
List all workspaces. Specify a filter to list all workspaces in a specific project.
Examples
>>> api.workspaces.find(project_uid="P1")
- Parameters:
order (int, optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
uid (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
created_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
updated_at (Tuple[datetime.datetime, datetime.datetime], optional) – Defaults to None
deleted (bool, optional) – Defaults to False
- Returns:
Successful Response
- Return type:
List[Workspace]
- find_one(project_uid: str, workspace_uid: str, /) Workspace#
Find a specific workspace in a project
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- Returns:
Successful Response
- Return type:
- find_workspace_ancestor_uids(project_uid: str, workspace_uid: str, /, *, job_uids: List[str]) WorkspaceAncestorUidsResponse#
Finds ancestors of the given jobs in the workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
job_uids (List[str])
- Returns:
Successful Response
- Return type:
- find_workspace_descendant_uids(project_uid: str, workspace_uid: str, /, *, job_uids: List[str]) WorkspaceDescendantUidsResponse#
Finds descendants of jobs in the workspace
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
job_uids (List[str])
- Returns:
Successful Response
- Return type:
- preview_delete(project_uid: str, workspace_uid: str, /) DeleteWorkspacePreview#
Get a list of jobs that would be removed when the given workspace is deleted.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- Returns:
Successful Response
- Return type:
- remove_tag(project_uid: str, workspace_uid: str, tag_uid: str, /) Workspace#
Removes a tag from a workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
tag_uid (str)
- Returns:
Successful Response
- Return type:
- set_description(project_uid: str, workspace_uid: str, /, description: str) Workspace#
Set description of a workspace
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
description (str)
- Returns:
Successful Response
- Return type:
- set_title(project_uid: str, workspace_uid: str, /, *, title: str) Workspace#
Set title of a workspace
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
title (str)
- Returns:
Successful Response
- Return type:
- star_workspace(project_uid: str, workspace_uid: str, /) Workspace#
Stars a workspace for a user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- Returns:
Successful Response
- Return type: