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 |
|
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.job_groupsfunctionsapi.jobsfunctionsapi.notificationsfunctionsapi.projectsfunctionsapi.resourcesfunctionsapi.sessionsfunctionsapi.tagsfunctionsapi.usersfunctionsapi.workflowsfunctionsapi.workspacesfunctionsMethods:
__init__([base_url, auth, headers, timeout])health()Health check endpoint to verify that the API is running and responsive.
Information and metadata about job types available in this instance.
login(*[, expires_in, grant_type, scope, ...])Login form.
Get basic information about the API, including running CryoSPARC version.
start_and_migrate(*, license_id)Start up CryoSPARC for the first time after installation or after an upgrade.
test(delay, /)Sleep for the specified number of seconds and returns a value to indicate endpoint is working correctly.
- __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#
Health check endpoint to verify that the API is running and responsive.
- Returns:
Successful Response
- Return type:
str
- instance: InstanceAPI#
api.instancefunctions
- job_groups: JobgroupsAPI#
api.job_groupsfunctions
- job_register() JobRegister#
Information and metadata about job types available in this instance.
- 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
- read_root() Hello#
Get basic information about the API, including running CryoSPARC version.
- Returns:
Successful Response
- Return type:
- resources: ResourcesAPI#
api.resourcesfunctions
- sessions: SessionsAPI#
api.sessionsfunctions
- start_and_migrate(*, license_id: str) None#
Start up CryoSPARC for the first time after installation or after an upgrade. Triggers any migrations, refreshes connected targets and updates on-disk project files to the latest schema.
- 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
- 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])Find files available in the database associated with projects or jobs.
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]#
Find files available in the database associated with projects or jobs.
Each entry in the resulting list is an object with an
idkey. Useidto download the file.- 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)#
Type representing an auth token or email/password tuple.
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 a performance benchmark measured by the given benchmarking job.
Get reference benchmarks for comparison against newly-measured benchmarks.
- get_benchmark(project_uid: str, job_uid: str, benchmark_type: str, /) PerformanceBenchmark#
Get a performance benchmark measured by the given benchmarking job.
- Parameters:
project_uid (str)
job_uid (str)
benchmark_type (str)
- Returns:
Successful Response
- Return type:
- get_reference_benchmarks() List[ReferencePerformanceBenchmark]#
Get reference benchmarks for comparison against newly-measured benchmarks.
- Returns:
Successful Response
- Return type:
- class BlueprintsAPI#
Functions available in
api.blueprints, e.g.,api.blueprints.find(...)Methods:
create(body)Create or import a blueprint for a job.
delete(blueprint_id, /)Delete a blueprint.
draft_blueprint_from_job(*, project_uid, job_uid)Create a blueprint from a job without saving it
edit(blueprint_id, /[, parameters, title, ...])Edit an existing blueprint
find(*[, id, job_type, created_by, pinned, ...])List blueprints that match the supplied filters (all if no filters specified).
find_one(blueprint_id, /)Get a blueprint by its id
get_draft(job_type, /)- delete(blueprint_id: str, /) None#
Delete a blueprint.
- Parameters:
blueprint_id (str)
- draft_blueprint_from_job(*, project_uid: str, job_uid: str) Blueprint#
Create a blueprint from a job without saving it
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- edit(blueprint_id: str, /, parameters: Dict[str, BlueprintParameter] | None = None, *, title: str | None = None, description: str | None = None, apply_title: bool | None = None, apply_description: bool | None = None, pinned: bool | None = None) Blueprint#
Edit an existing blueprint
- Parameters:
blueprint_id (str)
parameters (Dict[str, BlueprintParameter], optional) – Defaults to None
title (str, optional) – Defaults to None
description (str, optional) – Defaults to None
apply_title (bool, optional) – Defaults to None
apply_description (bool, optional) – Defaults to None
pinned (bool, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- find(*, id: List[str] | None = None, job_type: List[str] | None = None, created_by: str | None = None, pinned: bool | None = None, imported: bool | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Blueprint]#
List blueprints that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
job_type (List[str], optional) – Defaults to None
created_by (str, optional) – Defaults to None
pinned (bool, optional) – Defaults to None
imported (bool, 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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Blueprint]
- class CacheAPI#
Functions available in
api.cache, e.g.,api.cache.get(...)Methods:
get(key, /, *[, namespace])Get cached data.
set(key, /[, value, namespace, ttl])Set cache key to the given value, with a ttl (Time-to-Live) in seconds
- get(key: str, /, *, namespace: str | None = None) Any#
Get cached data. 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#
Set cache 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])Get config collection entry value for the given variable name.
Get Instance file browser settings
Get this CryoSPARC instance's unique UID.
System information related to the CryoSPARC application
Get the current CryoSPARC version (with patch suffix, if available)
set_default_job_priority(value)Job priority
Update instance file browser settings
set_instance_banner(*[, active, title, body])Update the banner message shown on the home page
set_login_message(*[, active, title, body])Update the alert message shown in the app following user login
write(name, /[, value, set_on_insert_only])Set config collection entry.
- get(name: str, /, *, default: Any = '<<UNDEFINED>>') Any#
Get config collection entry value for the given variable name. Set
defaultto return a default value instead of raising a 404 error if the variable is not found.- Parameters:
name (str)
default (Any, optional) – Defaults to ‘<<UNDEFINED>>’
- Returns:
Successful Response
- Return type:
Any
- get_file_browser_settings() FileBrowserSettings#
Get Instance file browser settings
- Returns:
Successful Response
- Return type:
- get_instance_uid() str#
Get 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#
Get 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: FileBrowserSettings) None#
Update instance file browser settings
- Parameters:
body (FileBrowserSettings)
- set_instance_banner(*, active: bool = False, title: str | None = None, body: str | None = None) Any#
Update the banner message shown on the home page
- 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#
Update the alert message shown in the app following user login
- 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#
Set 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, ...)Add a manual particle pick to an exposure.
count(*[, id, uid, session_uid, ...])Count Live session exposures that match the supplied filters (all if no filters specified).
find(*[, id, uid, session_uid, project_uid, ...])List Live session exposures that match the supplied filters (all if no filters specified).
find_one(project_uid, session_uid, ...)Find an exposure within a session by its numeric ID.
get_individual_picks(project_uid, ...)Get list of particle picks for an exposure.
manual_reject_exposure(project_uid, ...)Manually reject exposure.
manual_unreject_exposure(project_uid, ...)Manually unreject exposure.
mark_failed(project_uid, session_uid, ...)Mark an exposure as failed.
remove_manual_pick(project_uid, session_uid, ...)Remove manual particle pick from an exposure
reprocess_single_exposure(project_uid, ...)Set a test exposure for the session, reprocess with the given parameters.
reset_all_exposures(project_uid, session_uid, /)Reset all exposures in a session to initial state.
reset_exposure(project_uid, session_uid, ...)Reset exposure to initial state.
reset_failed_exposures(project_uid, ...)Reset all failed exposures in a session to initial state.
reset_manual_reject_exposures(project_uid, ...)Reset manual rejection status on all exposures in a session.
toggle_manual_reject_exposure(project_uid, ...)Toggle manual rejection state on exposure.
- add_manual_pick(project_uid: str, session_uid: str, exposure_uid: int, /, *, x_frac: float, y_frac: float) Exposure#
Add a manual particle 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(*, id: List[str] | None = None, 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, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) int#
Count Live session exposures that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
int
- find(*, id: List[str] | None = None, 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, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Exposure]#
List Live session exposures that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Exposure]
- find_one(project_uid: str, session_uid: str, exposure_uid: int, /) Exposure#
Find an exposure within a session by its numeric ID.
- 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]]#
Get list of particle picks for an exposure. Each item in the list is a list of four floating point numbers which represent the following:
x fractional coordinate of the pick
y fractional coordinate of the pick
Pick’s Noise Cross-Correlation (NCC) score, if applicable, otherwise 0
Pick’s Power score, if applicable, otherwise 0
- 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 reject 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 unreject 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#
Remove manual particle 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#
Set a test exposure for the session, reprocess with the given parameters. If the session already has a test exposure, it is reset to the “ctf” stage and its test status is removed.
- 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#
Reset 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#
Reset exposure to initial 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#
Reset 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]#
Reset 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 the latest CryoSPARC changelog.
Get categories available in the CryoSPARC discussion forum.
Get top weekly topics in the CryoSPARC discussion forum.
Get information for the 6 most-recently released EMDB entries.
Get information for the 6 most-recently submitted EMPIAR datasets.
Get information about available CryoSPARC tutorials.
- get_changelog() Dict[str, Any]#
Get the latest CryoSPARC changelog.
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_discuss_categories() Dict[str, Any]#
Get categories available in the CryoSPARC discussion forum.
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_discuss_top() Dict[str, Any]#
Get top weekly topics in the CryoSPARC discussion forum.
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_emdb_latest_entries() List[Dict[str, Any]]#
Get information for the 6 most-recently released EMDB entries.
- Returns:
Successful Response
- Return type:
List[Dict[str, Any]]
- get_empiar_latest_entries() Dict[str, Any]#
Get information for the 6 most-recently submitted EMPIAR datasets.
- Returns:
Successful Response
- Return type:
Dict[str, Any]
- get_tutorials() Dict[str, Any]#
Get information about available CryoSPARC tutorials.
- 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 CryoSPARC a commercial license is enabled
Check if embedded CryoSPARC Live is enabled
generate_new_uid(*[, force_takeover_projects])Generate a new uid for the CryoSPARC instance.
get_instance_activity(*[, limit])Get license usage information
Get runtime diagnostics for the CryoSPARC instance
get_service_log(service, /, *[, start, end, ...])Get master service logs.
Get information about the latest CryoSPARC version update, if one is available.
Check 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 folder, returns a list of files and subfolders in that folder.
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:
- commercial_enabled() bool#
Checks if CryoSPARC a commercial license is enabled
- Returns:
Successful Response
- Return type:
bool
- ecl_enabled() bool#
Check if embedded CryoSPARC Live is enabled
- Returns:
Successful Response
- Return type:
bool
- generate_new_uid(*, force_takeover_projects: bool = False) str#
Generate a new uid for the CryoSPARC instance. If
force_takeover_projectsis enabled, 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_instance_activity(*, limit: int | None = 100) List[InstanceActivity]#
- Parameters:
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[InstanceActivity]
- get_license_usage() List[LicenseInstance]#
Get license usage information
- Returns:
Successful Response
- Return type:
List[LicenseInstance]
- get_runtime_diagnostics() RuntimeDiagnostics#
Get 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', 'search', 'supervisord'], /, *, start: datetime | None = None, end: datetime | None = None, max_lines: int | None = None) Any#
Get master service logs. Serves the whole log by default.
Provide a maximum number of lines to return from the end of the log file. If no maximum is provided, return the entire log file.
Provide a start and/or end time to filter logs to a specific time range. If the start and end times do not include a timezone, they will be assumed to be in server time.
If only
startis provided, reads from the first line afterstart. If onlyendis provided, reads in reverse order fromend.- Parameters:
service (LoggingService)
start (datetime.datetime, optional) – Defaults to None
end (datetime.datetime, optional) – Defaults to None
max_lines (int, optional) – Defaults to None
- Returns:
A binary stream representing a TextStream class instance
- Return type:
Any
- get_update_tag() UpdateLicenseTag | None#
Get information about the latest CryoSPARC version update, if one is available.
- Returns:
Successful Response
- Return type:
UpdateLicenseTag | None
- live_enabled() bool#
Check if CryoSPARC Live is enabled
- Returns:
Successful Response
- Return type:
bool
- class JobgroupsAPI#
Functions available in
api.job_groups, e.g.,api.job_groups.get(...)Methods:
create(project_uid, workspace_uid, /, body)Create a job group
delete(project_uid, workspace_uid, group_id, /)edit(project_uid, workspace_uid, group_id, ...)get(project_uid, workspace_uid, group_id, /)Get a job group by ID.
- create(project_uid: str, workspace_uid: str, /, body: JobGroupCreate) JobGroup#
Create a job group
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
body (JobGroupCreate)
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, workspace_uid: str, group_id: int, /) Workspace#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
group_id (int)
- Returns:
Successful Response
- Return type:
- edit(project_uid: str, workspace_uid: str, group_id: int, /, body: JobGroupUpdate) Workspace#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
group_id (int)
body (JobGroupUpdate)
- Returns:
Successful Response
- Return type:
- 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 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, /)Add a tag to a job.
apply_blueprint(project_uid, job_uid, /, *, ...)clear(project_uid, job_uid, /, *[, descendants])Clear a job's outputs and events to get it back to building state.
clear_intermediate_results(project_uid, ...)Remove intermediate results from a job.
clear_many(*[, id, project_uid, ...])Clear all jobs that match the given query.
clear_param(project_uid, job_uid, param, /)Reset a job parameter to its default value.
clear_params(project_uid, job_uid, /)Reset all job parameters to their default values.
clone(project_uid, job_uid, /, *[, ...])Clone a job, creating a new building job with the same inputs and parameters but no outputs.
clone_chain(project_uid, /, *, ...[, ...])Clone jobs that directly descend from the specified start job up to the specified end job.
clone_many(project_uid, /, job_uids, *[, ...])Clone the given list of jobs.
connect(project_uid, job_uid, input_name, /, ...)Connect the output of a parent (source) job to the input of a child (dest) job.
connect_result(project_uid, job_uid, ...[, ...])Connect or replace a low-level input result slot to an output result from another (source) job.
count(*[, id, project_uid, workspace_uid, ...])Count jobs that match the supplied filters (all if no filters specified).
Count number of active jobs.
create(project_uid, workspace_uid, /[, ...])Add a new job with the given type to a project workspace.
create_external_result(project_uid, ...)Create an External result with the given specification.
create_job_from_blueprint(project_uid, ...)delete(project_uid, job_uid, /)Delete a job and all associated events and results.
delete_many(project_job_uids)Delete 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, ...)Disconnect a job input.
disconnect_all(project_uid, job_uid, ...)Remove all connections on the given job input.
disconnect_result(project_uid, job_uid, ...)Clear a job's low-level input result slot.
enqueue(project_uid, job_uid, /, *[, lane, ...])Queue a job for execution.
export_job(project_uid, job_uid, /)Start export for a job into the project's exports folder.
export_output_results(project_uid, job_uid, ...)Prepare a job's output for import to another project or instance.
find(*[, id, project_uid, workspace_uid, ...])List jobs that match the supplied filters (all if no filters specified).
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 a job is an ancestor of based on its outputs.
find_one(project_uid, job_uid, /)Get a job by its unique project and job ID.
find_output_result(project_uid, job_uid, ...)Get a job's low-level output result.
Get number of acquired licenses for running jobs
Get job types by category
get_chain(project_uid, /, *, start_job_uid, ...)Find the chain of jobs between start job to end job.
get_directory(project_uid, job_uid, /)Get a job's absolute directory path, e.g.,
"/path/to/project/{job_uid}".get_event_logs(project_uid, job_uid, /, *[, ...])Get all event logs for a job.
get_final_results(project_uid, /)Get all final results within a project, along with the ancestors and non-ancestors of those jobs.
get_log(project_uid, job_uid, /)Get contents of a 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, /)Get the status of a job.
get_symlinks(project_uid, job_uid, /)Get all symbolic links in a job directory.
Get list of available job types
import_job(project_uid, workspace_uid, /, *)Import a job into a project workspace from a location on disk.
import_result_group(project_uid, ...[, ...])Create and enqueue an Import Result Group job with the given path
interactive_post(project_uid, job_uid, /, ...)Send a message to or perform an interactive action on a waiting interactive job.
kill(project_uid, job_uid, /)Kill a running job.
link_to_workspace(project_uid, job_uid, ...)Link a job to an additional workspace.
load_input(project_uid, job_uid, input_name, ...)Load the dataset connected to a job input.
load_output(project_uid, job_uid, ...[, ...])Load the dataset for a job output.
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, /, *, ...)Move a job from one workspace to another.
Recalculate intermediate result sizes for all jobs in a project.
recalculate_size(project_uid, job_uid, /)Recalculate the size of a given job's directory.
recalculate_size_async(project_uid, job_uid, /)For a given 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, /)Remove a tag from a job.
restart(project_uid, job_uid, /)Kill and clear a completed or partially-completed job, queue it with the same scheduler settings as its previous run.
save_output(project_uid, job_uid, ...[, ...])Save job output dataset.
set_cluster_custom_vars(project_uid, ...)Set cluster custom variables for job
set_description(project_uid, job_uid, /[, ...])Set job description.
set_final_result(project_uid, job_uid, /, *, ...)Mark or unmark 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)Set a job parameter to the given value.
set_params(project_uid, job_uid, /, params)Update job parameters with the given values.
set_priority(project_uid, job_uid, /, *, ...)Set 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)Set job title.
star_job(project_uid, job_uid, /)Stars a job for a user
unlink_from_workspace(project_uid, job_uid, ...)Unlink a job from a workspace.
unstar_job(project_uid, job_uid, /)Unstars a job for a user
update_directory_symlinks(project_uid, ...)Rewrite symbolic link target paths in a job directory, changing target paths with prefix
prefix_cutto instead have prefixprefix_new.update_event_log(project_uid, job_uid[, ...])Update a text event log entry for a job.
view(project_uid, workspace_uid, job_uid, /)Add a job 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], optional) – Defaults to {}
- 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 input.
This action is available while the job is building, running or waiting for results. Completed or failed External jobs cannot accept new inputs.
- 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#
Add a tag to a job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- apply_blueprint(project_uid: str, job_uid: str, /, *, blueprint_id: str) Job#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
blueprint_id (str)
- Returns:
Successful Response
- Return type:
- clear(project_uid: str, job_uid: str, /, *, descendants: bool = False) Job#
Clear a job’s outputs and events to get it back to building state. Active jobs must be killed before clearing.
Retains input connections and parameter overrides.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
descendants (bool, optional) – Enable to also clear all descendant jobs. Defaults to False
- Returns:
Successful Response
- Return type:
- clear_intermediate_results(project_uid: str, job_uid: str, /, *, always_keep_final: bool = True) None#
Remove intermediate results from a 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(*, id: List[str] | None = None, 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, deleting: bool | None = None, import_status: str | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Job]#
Clear all jobs that match the given query.
- Parameters:
id (List[str], optional) – Defaults to None
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
deleting (bool, optional) – Defaults to None
import_status (str, optional) – Defaults to None
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Job]
- clear_param(project_uid: str, job_uid: str, param: str, /) Job#
Reset a job parameter to its default value.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
param (str) – Job parameter name
- Returns:
Successful Response
- Return type:
- clear_params(project_uid: str, job_uid: str, /) Job#
Reset all job parameters to their default values.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
- clone(project_uid: str, job_uid: str, /, *, workspace_uid: str | None = None) Job#
Clone a job, creating a new building job with the same inputs and parameters but no outputs.
If
workspace_uidis not specified, clones into the oldest workspace the original job is linked to.- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
workspace_uid (str, optional) – Target workspace to create the cloned job in. 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]#
Clone jobs that directly descend from the specified start job up to the specified end job.
- 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]#
Clone the given list of jobs. If any target jobs are related, tries to re-create the input connections between the cloned jobs, while keeping connections to non-cloned jobs.
- 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#
Connect the output of a parent (source) job to the input of a child (dest) job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
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#
Connect or replace a low-level input result slot to an output result from another (source) job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
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(*, id: List[str] | None = None, 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, deleting: bool | None = None, import_status: str | None = None) int#
Count jobs that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
deleting (bool, optional) – Defaults to None
import_status (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
int
- count_active() int#
Count number of active jobs.
- 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 = '') Job#
Add a new job with the given type to a project workspace.
All available job types and associated metadata are available from the
api.projects.get_job_register()function (GET projects/{project_uid}:registerendpoint).- 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) – Job title. Defaults to ‘’
description (str, optional) – Job Markdown description. Defaults to ‘’
- 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:
- create_job_from_blueprint(project_uid: str, workspace_uid: str, /, *, blueprint_id: str) Job#
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
blueprint_id (str)
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, job_uid: str, /) None#
Delete a job and all associated events and results.
A job cannot be deleted if it is in any of the following states:
Active (running or waiting); please kill the job first
Marked as final
An ancestor of a job marked as final
Has connected child jobs that are running, waiting, completed, killed or failed; please clear or delete all connected jobs first
- 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#
Delete the given jobs. Note that jobs in the following states cannot be deleted:
Job is active (running or waiting); please kill the job first
Job is marked as final
Job is an ancestor of a job marked as final
Job has connected child jobs that are running, waiting, completed, killed or failed; please clear or delete all connected jobs first
- 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) – Job output name
result_name (str)
- disconnect(project_uid: str, job_uid: str, input_name: str, connection_index: int, /) Job#
Disconnect a job input.
Set
connection_index0 to remove the first connection, 1 for the second, etc. Setconnection_indexto -1 to remove the last connection, -2 for the second-last, etc.- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
connection_index (int)
- Returns:
Successful Response
- Return type:
- disconnect_all(project_uid: str, job_uid: str, input_name: str, /) Job#
Remove all connections on the given job input.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
- Returns:
Successful Response
- Return type:
- disconnect_result(project_uid: str, job_uid: str, input_name: str, connection_index: int, result_name: str, /) Job#
Clear a job’s low-level input result slot.
Set
connection_index0 to remove the first connection, 1 for the second, etc. Setconnection_indexto -1 to remove the last connection, -2 for the second-last, etc.- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
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, oversubscribe_gpus: bool = False) Job#
Queue a job for execution. The job will launch when
all connected input jobs are completed (unless
no_check_inputs_readyis True)enough CPU/GPU/RAM is available on the lane or target
enough license tokens are available
Some job types that don’t require GPUs may be launched immediately by specifying neither lane nor target. Interactive jobs must be launched this way.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
lane (str, optional) – Connected scheduler lane name to queue to. Defaults to None
hostname (str, optional) – Target name to queue to, cannot be specified with lane. Defaults to None
gpus (List[int], optional) – GPU number(s) the job should use, target must also be specified. Defaults to []
no_check_inputs_ready (bool, optional) – If enabled, launch job without waiting for connected input jobs to complete. Defaults to False
oversubscribe_gpus (bool, optional) – If enabled, launch job even if target GPU(s) are already in use by another job.. Defaults to False
- Returns:
Successful Response
- Return type:
- export_job(project_uid: str, job_uid: str, /) None#
Start export for a job into the project’s exports folder.
- 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#
Prepare a job’s output for import to another project or instance. Will create a folder in the project directory’s exports subfolder, then link 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) – Job output name
result_names (List[str], optional) – Defaults to None
- find(*, id: List[str] | None = None, 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, deleting: bool | None = None, import_status: str | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Job]#
List jobs that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
deleting (bool, optional) – Defaults to None
import_status (str, optional) – Defaults to None
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- 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 a 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#
Get a job by its unique project and job ID.
- 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) – Job output name
result_name (str)
- Returns:
Successful Response
- Return type:
- get_active_licenses_count() int#
Get number of acquired licenses for running jobs
- Returns:
Successful Response
- Return type:
int
- get_categories() Any#
Get 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]#
Find 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#
Get a job’s absolute directory path, e.g.,
"/path/to/project/{job_uid}".- 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]#
Get all event logs for a job.
Note: this may return a large amount of data. Call repeatedly with an incrementing checkpoint to retrieve in batches.
- 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#
Get 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#
Get contents of a job.log file. 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) – Job output name
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']#
Get 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_symlinks(project_uid: str, job_uid: str, /) List[SymlinkInfo]#
Get all symbolic links in a job directory.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- Returns:
Successful Response
- Return type:
List[SymlinkInfo]
- get_types() Any#
Get list of available job types
- Returns:
Successful Response
- Return type:
Any
- import_job(project_uid: str, workspace_uid: str, /, *, path: str = '') Job#
Import a job into a project workspace from a location on disk.
The exported job directory must be copied into the target project directory with all its symbolic links resolved. By convention, the exported job directory should be located in the project directory →
importssubfolder.Resulting job will not be ready to use until
import_statusis “complete”.- 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 ‘’
- Returns:
Successful Response
- Return type:
- import_result_group(project_uid: str, workspace_uid: str, /, *, lane: str | None = None, path: str = '') Job#
Create and enqueue 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#
Send a message to or perform an interactive action on a waiting interactive job. Possible actions and expected body depend on the job type.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
body (Dict[str, Any])
endpoint (str) – Interactive endpoint to call, e.g., get_micrograph_data
timeout (int, optional) – Maximum time to wait for action to complete, in seconds. Defaults to 10
- Returns:
Successful Response
- Return type:
Any
- kill(project_uid: str, job_uid: str, /) Job#
Kill 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#
Link a job to an additional 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 the dataset connected to a job input.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
input_name (str) – Job input name
force_join (bool | Literal['auto'], optional) – Defaults to ‘auto’
slots (Literal['default', 'passthrough', 'all'] | List[str], optional) – Low-level results to load. 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 the dataset for a job output.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str) – Job output name
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) – Low-level results to load. 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. This prepares the job for accepting results.
- 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#
Move a job from one workspace to another. Equivalent to linking to the new workspace and unlinking from the old one.
- 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#
Recalculate 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#
Recalculate 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 given 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) – Job input name
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#
Remove a tag from a job.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- restart(project_uid: str, job_uid: str, /) None#
Kill and clear a completed or partially-completed job, queue it with the same scheduler settings as its previous run.
Retains input connections and parameter overrides.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
- 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 to accept outputs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
output_name (str) – Job output name
dataset (Dataset) – A binary stream representing a Dataset class instance
filename (str, optional) – Filename override. Defaults to None
version (int, optional) – Intermediate output version. 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#
Set 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#
Set job description. May include Markdown formatting.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
description (str, optional) – Defaults to ‘’
- Returns:
Successful Response
- Return type:
- set_final_result(project_uid: str, job_uid: str, /, *, is_final_result: bool) Job#
Mark or unmark a job as a final result. Final jobs and their connected ancestors cannot be cleared or deleted, and 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) – Job output name
body (GridFSAsset)
- Returns:
Successful Response
- Return type:
- set_param(project_uid: str, job_uid: str, param: str, /, value: Any) Job#
Set a job parameter to the given value.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
param (str) – Job parameter name
value (Any)
- Returns:
Successful Response
- Return type:
- set_params(project_uid: str, job_uid: str, /, params: Dict[str, Any]) Job#
Update job parameters with the given values. Only parameters that are valid for the job type are updated.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
params (Dict[str, Any])
- Returns:
Successful Response
- Return type:
- set_priority(project_uid: str, job_uid: str, /, *, priority: int) Job#
Set job priority. Once queued, higher priority jobs are scheduled before lower priority ones.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
priority (int) – Larger number indicates higher priority
- 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#
Set job title.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
job_uid (str) – Job UID, e.g., “J3”
title (str) – Job title
- 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#
Unlink a job from a workspace.
Fails if the job is not linked to the given workspace, or if this is the only workspace the job is linked to.
- 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#
Rewrite symbolic link target paths in a job directory, changing target paths with prefix
prefix_cutto instead have prefixprefix_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#
Add a job to a user’s recently viewed jobs list. Must specify the workspace from which the job was viewed.
- 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.find(...)Methods:
count(*[, id, project_uid, job_uid, active, ...])Count all notifications that match the supplied query.
deactivate_notification(notification_id, /)Deactivates a notification
find(*[, id, project_uid, job_uid, active, ...])List notifications that match the supplied query.
find_by_id(notification_id, /)Finds a notification by its ID
- count(*, id: List[str] | None = None, project_uid: List[str] | None = None, job_uid: List[str] | None = None, active: bool | None = None, status: List[Literal['success', 'primary', 'warning', 'danger']] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None) int#
Count all notifications that match the supplied query.
- Parameters:
id (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
job_uid (List[str], optional) – Defaults to None
active (bool, optional) – Defaults to None
status (List[Literal['success', 'primary', 'warning', 'danger']], 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
- Returns:
Successful Response
- Return type:
int
- deactivate_notification(notification_id: str, /) Notification#
Deactivates a notification
- Parameters:
notification_id (str)
- Returns:
Successful Response
- Return type:
- find(*, id: List[str] | None = None, project_uid: List[str] | None = None, job_uid: List[str] | None = None, active: bool | None = None, status: List[Literal['success', 'primary', 'warning', 'danger']] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Notification]#
List notifications that match the supplied query.
- Parameters:
id (List[str], optional) – Defaults to None
project_uid (List[str], optional) – Defaults to None
job_uid (List[str], optional) – Defaults to None
active (bool, optional) – Defaults to None
status (List[Literal['success', 'primary', 'warning', 'danger']], 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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Notification]
- find_by_id(notification_id: str, /) Notification#
Finds a notification by its ID
- Parameters:
notification_id (str)
- Returns:
Successful Response
- Return type:
- class ProjectsAPI#
Functions available in
api.projects, e.g.,api.projects.check_directory(...)Methods:
accept(project_uid, /, *[, path])Accept a failed attach for this project.
add_tag(project_uid, tag_uid, /)Add a tag to a project.
add_user_access(project_uid, user_id, /)Grant access to another user to view and edit the project.
archive(project_uid, /)Archive this project.
attach(*[, project_owner_id])Attach an existing project directory to this instance.
check_directory(*, path)Check if a candidate project directory exists, and if it is readable and writeable.
claim_all_instance_ownership(*[, force])Claim ownership of all projects in the instance.
claim_instance_ownership(project_uid, /, *)Claim ownership of an existing project with a missing lock file.
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, /)Clear the per-project default value for a job parameter.
clear_intermediate_results(project_uid, /, *)Remove intermediate results from the project.
count(*[, project_dir, owner_user_id, ...])Count projects available to the current user that match the supplied filters (all if no filters specified).
cp(project_uid, /, *, source[, path])Copy a file or folder to a project directory.
create(*, title[, description])Start a new empty project.
delete(project_uid, /)Start project deletion task.
detach(project_uid, /)Detach this project from this CryoSPARC instance, removing its lock file.
download_file(project_uid, /, *[, path])Download a file from the project directory.
find(*[, id, uid, created_at, updated_at, ...])List projects available to the current user that match the supplied filters (all if no filters specified).
find_one(project_uid, /)Get a project by its unique ID.
get_directory(project_uid, /)Get the project's absolute directory path with all environment variables resolved.
Get intermediate result job types
Get generate intermediate result settings.
get_job_register(project_uid, /)Get the job register model for the project.
get_next_exposure_group_id(project_uid, /)Get next exposure group ID
get_owner_id(project_uid, /)Get user account ID for the owner of a project.
get_symlinks(project_uid, /)Get all symbolic links in the project directory.
get_title_slug(*, title)Get a URL-friendly version of a project title.
ls(project_uid, /, *[, recursive, path])List files in the project directory.
mkdir(project_uid, /, *[, parents, ...])Create a subfolder in a project.
move(project_uid, /, *, path)Move the project directory to a new location on the file system.
preview_delete(project_uid, /)Get the workspaces and jobs that would be affected when the project is deleted.
refresh_size(project_uid, /)Start project size recalculation asynchronously.
remove_tag(project_uid, tag_uid, /)Remove a tag from a project.
remove_user_access(project_uid, user_id, /)Remove a user's access from a project.
reset_autodump(project_uid, /)Clear project directory write failures.
set_default_param(project_uid, name, /, value)Set a default value for a job parameter for use in a project.
set_description(project_uid, /[, description])Set project description.
Set settings for intermediate result generation.
set_owner(project_uid, user_id, /)Set owner of the project to the user
set_title(project_uid, /, *, title)Set project title.
star_project(project_uid, /)Star a project for the authenticated user
symlink(project_uid, /, *, source[, path])Create a symbolic link in a project directory.
unarchive(project_uid, /, *, path)Revert an archive operation.
unstar_project(project_uid, /)Unstar a project for the authenticated user
update_directory_symlinks(project_uid, /, *, ...)Rewrite symbolic link target paths in a project directory, changing target paths with prefix
prefix_cutto instead have prefixprefix_new.upload_file(project_uid, /, stream, *[, ...])Upload a file to the project directory.
view(project_uid, /)Add a project to a user's recently viewed projects list.
- accept(project_uid: str, /, *, path: str | None = None) Project#
Accept a failed attach for this project. Some job or workspace data may be inaccessible or lost after a failed attach, so use with caution.
Accepting a failed project will not fix any underlying issues with the project directory, such as missing files or corrupted data. Please ensure that the project is valid and complete before accepting. Instead of accepting a failed attach, consider investigating why the attach failed, then detach the project, fix the issue and re-attach.
Optionally provide a new project directory, if the project was moved there.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- add_tag(project_uid: str, tag_uid: str, /) Project#
Add a tag to a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- add_user_access(project_uid: str, user_id: str, /) Project#
Grant 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#
Archive this project. Archived projects are hidden in the web UI. They cannot be modified and their jobs cannot run. Once archived, an admin may safely move the project directory to a long-term storage location.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- attach(*, project_owner_id: str | None = None, path: str) Project#
Attach an existing project directory to this instance.
The directory may not already be attached to any other CryoSPARC instance. A lock file will be created in the project directory to prevent it from being attached to multiple instances at the same time.
Project will not be available to modify until the attach process completes, which may take some time depending on the size of the project.
Once attach completes, the project will be visible and modifiable in the web UI. The project is assigned a new unique ID upon attach.
- Parameters:
project_owner_id (str, optional) – Assign project to user with this ID or email. Defaults to None
path (str)
- Returns:
Successful Response
- Return type:
- check_directory(*, path: str) str#
Check 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#
Claim ownership of all projects in the instance. Use 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#
Claim ownership of an existing project with a missing lock file.
- 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, clear_intermediate_results: 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_intermediate_results (bool, optional) – Defaults to False
- clear_default_param(project_uid: str, name: str, /) Project#
Clear the per-project default value for a job parameter.
- 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#
Remove intermediate results from the project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
always_keep_final (bool, optional) – Defaults to True
- count(*, project_dir: str | None = None, owner_user_id: str | None = None, archived: bool | None = False, detached: bool | None = False, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100, id: List[str] | None = None, uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, users_with_access: List[str] | None = None) int#
Count projects available to the current user that match the supplied filters (all if no filters specified).
- Parameters:
project_dir (str, optional) – Defaults to None
owner_user_id (str, optional) – Defaults to None
archived (bool, optional) – Defaults to False
detached (bool, optional) – Defaults to False
order (Literal[-1, 1], optional) – Defaults to 1
after (str, optional) – Defaults to None
limit (int, optional) – Defaults to 100
id (List[str], optional) – Defaults to None
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
users_with_access (List[str], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
int
- cp(project_uid: str, /, *, source: str, path: str = '') str#
Copy a file or folder to a project directory. Returns the absolute path of the copied file or folder. May only copy files within the project directory or from paths the current user is authorized to access by an administrator.
Raises an error if the source is not readable or the destination is not writable.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
source (str) – Source path, either absolute or relative to project directory
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#
Start a new empty project. Creates new subfolder in the parent directory with a generated name based on the provided title.
- Parameters:
title (str)
description (str, optional) – Defaults to None
parent_dir (str)
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, /) None#
Start project deletion task. Will delete the project, its full directory, all associated workspaces, sessions, jobs and results. Kills any running jobs or active sessions in the project before deleting.
The directory for an archived or detached project will not be deleted, but the project and all associated jobs will be fully removed from the web UI.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- detach(project_uid: str, /) None#
Detach this project from this CryoSPARC instance, removing its lock file. Detached projects are hidden in the web UI and may be attached to other instances.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- download_file(project_uid: str, /, *, path: str = '') Stream#
Download a file from the project directory.
- 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(*, id: List[str] | None = None, uid: List[str] | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, project_dir: str | None = None, owner_user_id: str | None = None, users_with_access: List[str] | None = None, archived: bool | None = False, detached: bool | None = False, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Project]#
List projects available to the current user that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
project_dir (str, optional) – Defaults to None
owner_user_id (str, optional) – Defaults to None
users_with_access (List[str], optional) – Defaults to None
archived (bool, optional) – Defaults to False
detached (bool, optional) – Defaults to False
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Project]
- find_one(project_uid: str, /) Project#
Get a project by its unique ID.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- get_directory(project_uid: str, /) str#
Get the project’s absolute directory path with all environment variables resolved.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
str
- get_generate_intermediate_results_job_types() List[str]#
Get intermediate result job types
- Returns:
Successful Response
- Return type:
List[str]
- get_generate_intermediate_results_settings(project_uid: str, /) GenerateIntermediateResultsSettings#
Get 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#
Get 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#
Get 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[SymlinkInfo]#
Get all symbolic links in the project directory.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
List[SymlinkInfo]
- get_title_slug(*, title: str) str#
Get a URL-friendly 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
recursiveincludes both subdirectories and their files in the list.- Parameters:
project_uid (str) – Project UID, e.g., “P3”
recursive (bool, optional) – Include files in all subfolders. 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 subfolder in a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
parents (bool, optional) – Create missing parent folders. Defaults to False
exist_ok (bool, optional) – No error if folder already exists. 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) None#
Move the project directory to a new location on the file system.
Provide either the new folder name or the full new directory path. If the given path is a folder that already exists, the project directory will be moved inside it with the same name.
Returns immediately, the move operation is performed in the background.
May take a long time when moving projects between file systems.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str)
- preview_delete(project_uid: str, /) DeleteProjectPreview#
Get 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#
Start project size recalculation asynchronously.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- remove_tag(project_uid: str, tag_uid: str, /) Project#
Remove a tag from a project.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- remove_user_access(project_uid: str, user_id: str, /) Project#
Remove 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, 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#
Set a default value for a job parameter for use in a project. All new jobs created in the project will be initialized with this default value for the parameter.
- 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#
Set project description. May include Markdown formatting.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
description (str, optional) – Defaults to ‘’
- Returns:
Successful Response
- Return type:
- set_generate_intermediate_results_settings(project_uid: str, /, body: GenerateIntermediateResultsSettings) Project#
Set 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#
Set 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#
Set project title.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str) – Project title
- Returns:
Successful Response
- Return type:
- star_project(project_uid: str, /) Project#
Star a project for the authenticated 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 symbolic link in a project directory. May only create links to files or folders the user is authorized to access by an administrator.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
source (str) – Source path, either absolute or relative to project directory
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#
Revert an archive operation.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
path (str)
- Returns:
Successful Response
- Return type:
- unstar_project(project_uid: str, /) Project#
Unstar a project for the authenticated user
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
- Returns:
Successful Response
- Return type:
- update_directory_symlinks(project_uid: str, /, *, prefix_cut: str, prefix_new: str) int#
Rewrite symbolic link target paths in a project directory, changing target paths with prefix
prefix_cutto instead have prefixprefix_new.- Parameters:
project_uid (str) – Project UID, e.g., “P3”
prefix_cut (str)
prefix_new (str)
- Returns:
Number of symlinks updated
- Return type:
int
- upload_file(project_uid: str, /, stream: Stream, *, overwrite: bool = False, path: str = '') str#
Upload a file to the project directory.
Path may be specified as a filename, a relative path inside the project directory, or a full absolute path. When calling via HTTP, provide the contents of the file in the request body.
Returns the uploaded 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)Add a cluster or update an existing cluster.
add_lane(body)Add a new lane that jobs may be scheduled to.
add_node(body, *[, gpu])Add a node or update an existing node.
find_cluster(name, /)Find a cluster with the given name.
find_cluster_script(name, /)Find the cluster submission script template for a cluster with the given name.
find_cluster_template_custom_vars(name, /)Compute and retrieve 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, /)Compute and retrieve all variable names defined in cluster templates.
find_clusters(*[, lane])Find a list of targets with type "cluster" that that jobs may be scheduled to.
find_lane(name, /, *[, type])Find a registered scheduler lane with the given name and optional type.
Find registered scheduler lanes that jobs may be queued to.
find_node(name, /)Find a node with the given name.
find_nodes(*[, lane])Find a list of targets with type "node" that jobs may be scheduled to.
find_target_by_hostname(hostname, /)Find a node or cluster target with the given hostname.
find_target_by_name(name, /)Find a node or cluster target with the given name.
find_targets(*[, lane])Find a list of connected worker node or cluster targets that jobs may be queued to.
Asynchronously access target worker nodes.
remove_cluster(name, /)Remove the specified cluster lane and target assigned to it.
remove_lane(name, /)Remove the specified lane and any targets assigned to that lane.
remove_node(name, /)Remove a target worker node.
reorder_lanes(order)Reorder the lanes according to the given index list.
update_cluster_custom_vars(name, /, value)Change the custom cluster variables on the given target (assumed to exist).
update_node_lane(name, /, lane)Change the lane on the given target.
update_target_cache_path(name, /, value)Change the cache path on the given target (assumed to exist).
verify_cluster(name, /)Ensure cluster has been properly configured by executing the info command.
- add_cluster(body: SchedulerTargetCluster) SchedulerTargetCluster#
Add a cluster or update an existing cluster. Update an existing cluster if if has the same name.
- Parameters:
body (SchedulerTargetCluster)
- Returns:
Successful Response
- Return type:
- add_lane(body: SchedulerLane) SchedulerLane#
Add a new lane that jobs may be scheduled to.
- Parameters:
body (SchedulerLane)
- Returns:
Successful Response
- Return type:
- add_node(body: SchedulerTargetNode, *, gpu: bool = True) SchedulerTargetNode#
Add a node or update an existing node. Updates an existing node if it has 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#
Find a cluster with the given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_cluster_script(name: str, /) str#
Find the cluster submission script template for a cluster with the given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
str
- find_cluster_template_custom_vars(name: str, /) List[str]#
Compute and retrieve 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]#
Compute and retrieve 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]#
Find a list of targets with type “cluster” that that jobs may be scheduled to. 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#
Find a registered scheduler lane with the 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]#
Find registered scheduler lanes that jobs may be queued to.
- Returns:
List of lanes
- Return type:
List[SchedulerLane]
- find_node(name: str, /) SchedulerTargetNode#
Find a node with the given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_nodes(*, lane: str | None = None) List[SchedulerTargetNode]#
Find a list of targets with type “node” that jobs may be scheduled to. These correspond to discrete worker hosts 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#
Find a node or cluster target with the given hostname.
- Parameters:
hostname (str)
- Returns:
Successful Response
- Return type:
- find_target_by_name(name: str, /) SchedulerTarget#
Find a node or cluster target with the given name.
- Parameters:
name (str)
- Returns:
Successful Response
- Return type:
- find_targets(*, lane: str | None = None) List[SchedulerTarget]#
Find a list of connected worker node or cluster targets that jobs may be queued to.
- Parameters:
lane (str, optional) – Filter by lane name. 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#
Remove the specified cluster lane and target assigned to it. Once removed, jobs can no longer be scheduled to this cluster.
- Parameters:
name (str)
- remove_lane(name: str, /) None#
Remove the specified lane and any targets assigned to that lane. Once removed, jobs can no longer be scheduled to this lane.
- Parameters:
name (str)
- remove_node(name: str, /) None#
Remove a target worker node. Once removed, jobs can no longer be scheduled to this node.
- Parameters:
name (str)
- reorder_lanes(order: List[int]) List[SchedulerLane]#
Reorder the lanes according to the given index list. Accepts partial reordering, i.e., the list of indices does not need to include all lanes. The lanes not included in the list will be appended to the end of the reordered list in their original order.
- Parameters:
order (List[int])
- Returns:
Successful Response
- Return type:
List[SchedulerLane]
- update_cluster_custom_vars(name: str, /, value: Dict[str, str]) SchedulerTargetCluster#
Change 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#
Change the lane on the given target. Target type must match lane type. The lane will be created if it does not already exist.
- Parameters:
name (str)
lane (str)
- Returns:
Successful Response
- Return type:
- update_target_cache_path(name: str, /, value: str | None) SchedulerTarget#
Change 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#
Ensure cluster has been properly configured by executing the 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, /)Add a tag to a session.
apply_configuration_profile(project_uid, ...)Apply a configuration profile to a session, overwriting its resources, parameters, and exposure groups
clear_phase2_abinit(project_uid, session_uid, /)Clear Ab-Initio Reconstruction job for a session
clear_phase2_class2D(project_uid, session_uid, /)Clear streaming 2D Classification job for a session
clear_phase2_refine(project_uid, session_uid, /)Clear streaming Homogenous Refinement job for a session
clear_session(project_uid, session_uid, /)Delete all computed session data, including found and processed micrographs, 2D classes and volumes.
clear_template_creation_class2D(project_uid, ...)Clear template creation 2D classification job for a session
clone(project_uid, session_uid, /, *[, ...])Clone an existing session, copying session configuration, parameters, and exposure groups.
compact_session(project_uid, session_uid, /)Compact a session by clearing exposure processing results, including motion-corrected micrographs, extracted particle stacks, thumbnails and preview data.
configure_auto_pause(project_uid, ...[, ...])Configure auto-pause settings for a session, which come into effect once no more more new exposures are found for a session after some time (default 10 minutes).
count(*[, id, uid, session_uid, ...])Count sessions that match the supplied filters (all if no filters specified).
create(project_uid, /, *, title[, description])Create a new session.
create_and_enqueue_export_exposures(...[, ...])Create and queue a session Live Exposure Export job.
create_and_enqueue_export_particles(...[, ...])Create and queue a session Live Particle Export job.
Create a session configuration profile
create_exposure_group(project_uid, ...)Create an exposure group in a session.
delete(project_uid, session_uid, /)Start a background task to clear a session and mark as "deleted".
delete_configuration_profile(configuration_id, /)Delete a session configuration profile
delete_exposure_group(project_uid, ...)Delete an exposure group from a session.
enqueue_phase2_abinit(project_uid, ...)Enqueue Ab-Initio Reconstruction job for a session
enqueue_phase2_class2D(project_uid, ...)Enqueue streaming 2D Classification job for a session
enqueue_phase2_refine(project_uid, ...)Enqueue a streaming Homogenous Refinement job for a session
export_session(project_uid, session_uid, /, *)Write session results, including all motion-corrected exposures and extracted particles, to the project exports directory.
finalize_exposure_group(project_uid, ...)Finalize a session exposure group.
find(*[, id, uid, session_uid, project_uid, ...])List sessions that match the supplied filters (all if no filters specified).
find_exposure_group(project_uid, ...)Find an exposure group with a specific ID in a session.
find_exposure_groups(project_uid, session_uid, /)Find all exposure groups in a session.
find_one(project_uid, session_uid, /)Find a session in a project.
Get all session configuration profiles
Get base session parameter details.
get_symlinks(project_uid, session_uid, /)Get all symbolic links in the session directory.
mark_session_completed(project_uid, ...)Mark the session as completed
pause(project_uid, session_uid, /)Gracefully stop and kill all preprocessing and streaming jobs associated with the session.
refresh_size(project_uid, session_uid, /)Update session data size and statistics.
reinitialize_phase2_class2D(project_uid, ...)Setup an existing streaming 2D classification job for a session.
remove_tag(project_uid, session_uid, tag_uid, /)Remove a tag from a session.
reset_all_attribute_thresholds(project_uid, ...)Reset all attribute thresholds for a session
reset_attribute_threshold(project_uid, ...)Reset attribute threshold for a session
restore_session(project_uid, session_uid, /, ...)Restore exposures of a compacted session.
select_all_class2d_templates(project_uid, ...)Select or deselect all templates for a session's streaming 2D Classification job.
select_all_picking_templates(project_uid, ...)Select or deselect all templates for a session's template creation job
Select or deselect all templates inclusively above or below a specific template for a session's streaming 2D Classification.
Select templates for a session's streaming 2D Classification job based on the given thresholds.
select_phase2_abinit_volume(project_uid, ...)Select one of the computed or loaded volumes in a session's Ab-Initio Reconstruction stage, if multiple are available.
Select or deselect all templates above or below a specific template for a session's template creation job.
Select all templates above or below an index for a session's template creation job
set_phase2_abinit_job(project_uid, ...)Set a Live Ab-Initio Reconstruction job for a session.
Set session exposure processing priority
Set whether to wait until exposures are available before queuing the session's preprocessing worker jobs.
set_template_creation_job(project_uid, ...)Set template creation 2D classification 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 2D classification job for a session
star_session(project_uid, session_uid, /)Star a session for the authenticated user
start(project_uid, session_uid, /)Build and start a CryoSPARC Live Session.
start_extract_manual(project_uid, session_uid, /)Extract manually picked particles in a session.
stop_phase2_abinit(project_uid, session_uid, /)Stop the running Ab-Initio Reconstruction job for a session.
stop_phase2_class2D(project_uid, session_uid, /)Stop streaming 2D Classification job for a session
stop_phase2_refine(project_uid, session_uid, /)Stop a streaming Homogenous Refinement job for a session
toggle_all_class2d_templates(project_uid, ...)Toggle the selection state of all templates for a session's streaming 2D classification job.
toggle_all_picking_templates(project_uid, ...)Toggle the selection status of all templates for a session's template creation job
toggle_class2d_template(project_uid, ...)Toggle a specific 2D template for a session's streaming 2D classification job.
toggle_picking_template(project_uid, ...)Toggle a template for a session's template creation job at a specific index
unstar_session(project_uid, session_uid, /)Unstar a session for the authenticated user
update_attribute_threshold(project_uid, ...)Update thresholds for a given session attribute.
update_compute_configuration(project_uid, ...)Update compute resource configuration for a session.
Update a session configuration profile
update_directory_symlinks(project_uid, ...)Rewrites all symbolic links in the session directory, modifying links prefixed with prefix_cut to instead be prefixed with prefix_new.
update_exposure_group(project_uid, ...)Configure a session exposure group.
update_phase2_abinit_params(project_uid, ...)Update Ab-Initio Reconstruction parameters for a session
update_phase2_class2D_params(project_uid, ...)Update streaming 2D Classification job params for session
update_phase2_refine_params(project_uid, ...)Update streaming Homogenous Refinement job parameteres for a session
update_picking_threshold_values(project_uid, ...)Update picking threshold values for a session
update_session_params(project_uid, ...[, ...])Update a session's parameters.
view(project_uid, session_uid, /)Add the session to a user's recently viewed sessions list
- add_tag(project_uid: str, session_uid: str, tag_uid: str, /) Session#
Add a tag to a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- apply_configuration_profile(project_uid: str, session_uid: str, /, *, configuration_id: str) Session#
Apply a configuration profile to a session, overwriting its resources, parameters, and exposure groups
- 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#
Clear 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#
Clear 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#
Clear 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#
Delete all computed session data, including found and processed micrographs, 2D classes and volumes. Retains associated processing jobs created while the session was running, though their outputs will no longer be usable.
- 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#
Clear template creation 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:
- clone(project_uid: str, session_uid: str, /, *, title: str | None = None, description: str | None = None) Session#
Clone 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
- Returns:
Successful Response
- Return type:
- compact_session(project_uid: str, session_uid: str, /) None#
Compact a session by clearing exposure processing results, including motion-corrected micrographs, extracted particle stacks, thumbnails and preview data. Retains original particle picks for re-extraction if the session is restored. The session can be restored as long as the original movies are not deleted.
- 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#
Configure auto-pause settings for a session, which come into effect once no more more new exposures are found for a session after some time (default 10 minutes).
Set to “immediate” to pause as soon as all exposures are marked as ready, regardless of the status of other session jobs.
Set to “graceful” to wait until reconstruction jobs (streaming 2D Classification and streaming 3D Refinement) enter “waiting” status.
- 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(*, id: List[str] | None = None, 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#
Count sessions that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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) Session#
Create a new session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str)
description (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#
Create and queue a session Live Exposure Export job. Job will run on master.
- 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#
Create and queue a session Live Particle Export job. Job will run on master.
- 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#
Create a session configuration profile
- Parameters:
body (SessionConfigProfileBody)
- Returns:
Successful Response
- Return type:
- create_exposure_group(project_uid: str, session_uid: str, /) ExposureGroup#
Create an exposure group 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:
- delete(project_uid: str, session_uid: str, /) None#
Start a background task to clear a session and mark as “deleted”. Raise an error notification if the session contains jobs that cannot be deleted.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- delete_configuration_profile(configuration_id: str, /) None#
Delete a session configuration profile
- Parameters:
configuration_id (str)
- delete_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) Session#
Delete 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#
Enqueue 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#
Enqueue 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#
Enqueue 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#
Write session results, including all motion-corrected exposures and extracted particles, to the project exports directory.
The resulting folder contains .csg files. Copy the folder to another CryoSPARC project (while resolving symlinks) and import .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/
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
export_movies (bool, optional) – Include original movies. Defaults to False
export_ignored_exposures (bool, optional) – Include ignored exposures. Defaults to False
picker_type (Literal['blob', 'template', 'manual'], optional) – Include particles from this picker type instead of session selection. Defaults to None
- finalize_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) ExposureGroup#
Finalize a session exposure group. If the session is running, CryoSPARC begins checking for new exposures in the group and processes them as they are found.
- 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(*, id: List[str] | None = None, 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, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Session]#
List sessions that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Session]
- find_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /) ExposureGroup#
Find an exposure group with a specific ID in 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]#
Find 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#
Find a session in a project.
- 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]#
Get all session configuration profiles
- Returns:
Successful Response
- Return type:
List[SessionConfigProfile]
- get_session_base_params() Any#
Get base session parameter details.
- Returns:
Successful Response
- Return type:
Any
- get_symlinks(project_uid: str, session_uid: str, /) List[SymlinkInfo]#
Get all symbolic links in the session directory.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
List[SymlinkInfo]
- mark_session_completed(project_uid: str, session_uid: str, /) Session#
Mark 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#
Gracefully stop and kill all preprocessing and streaming jobs associated with the session. Stop checking for and processing new exposures.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- Returns:
Successful Response
- Return type:
- refresh_size(project_uid: str, session_uid: str, /) None#
Update session data size and statistics.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
- reinitialize_phase2_class2D(project_uid: str, session_uid: str, /) Job#
Setup an existing 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#
Remove a tag from a session.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
tag_uid (str) – Tag UID, e.g., “T1”
- Returns:
Successful Response
- Return type:
- reset_all_attribute_thresholds(project_uid: str, session_uid: str, /) Session#
Reset 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#
Reset 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#
Restore exposures of a compacted session. Starts Live preprocessing worker(s) on the specified lane. Each exposure is motion-corrected, the CTF is re-estimated, and particles are re-extracted using the original picks.
- 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#
Select or deselect 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”
direction (Literal['select', 'deselect'])
- Returns:
Successful Response
- Return type:
- select_all_picking_templates(project_uid: str, session_uid: str, direction: Literal['select', 'deselect'], /) Session#
Select or deselect 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”
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#
Select or deselect all templates inclusively above or below a specific template for a session’s streaming 2D Classification. All templates within the threshold of the specified template index will be selected, and all others will be deselected.
- 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#
Select templates for a session’s streaming 2D Classification job based on the given thresholds.
- 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#
Select one of the computed or loaded volumes in a session’s Ab-Initio Reconstruction stage, if multiple are available. The selected volume is used for streaming homogeneous refinement.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
volume_name (str) – Volume output name from the session’s Ab-Initio job, if multiple classes are available. e.g., “volume_class_0”
- 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#
Select or deselect all templates above or below a specific template for a session’s template creation job. All templates within the threshold of the the specified template index will be selected, and all others will be deselected.
- 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#
Select all templates above or below an 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_selection_thresholds (List[TemplateSelectionThreshold])
- Returns:
Successful Response
- Return type:
- set_phase2_abinit_job(project_uid: str, session_uid: str, /, *, job_uid: str) Session#
Set a Live Ab-Initio Reconstruction job for a 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#
Set 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#
Set 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 2D classification 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) – Project where the template creation job is located, assumed to be in the same project as the session if not specified. 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 2D classification 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#
Star a session for the authenticated 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#
Build and start a CryoSPARC Live Session. Resources, parameters and exposure groups must already be configured.
- 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#
Extract manually picked particles in 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#
Stop the running 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#
Stop 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#
Stop 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#
Toggle the selection state of 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#
Toggle the selection status of 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#
Toggle a specific 2D template 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”
template_idx (int)
- Returns:
Successful Response
- Return type:
- toggle_picking_template(project_uid: str, session_uid: str, template_idx: int, /) Session#
Toggle a template for a session’s template creation job at a specific index
- 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#
Unstar a session for the authenticated 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#
Update thresholds for a given session 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#
Update compute resource 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#
Update a session configuration profile
- Parameters:
configuration_id (str)
body (SessionConfigProfileBody)
- Returns:
Successful Response
- Return type:
- update_directory_symlinks(project_uid: str, session_uid: str, /, *, prefix_cut: str, prefix_new: str) int#
Rewrites all symbolic links in the session directory, modifying links prefixed with prefix_cut to instead be prefixed with prefix_new.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
session_uid (str) – Session UID, e.g., “S3”
prefix_cut (str)
prefix_new (str)
- Returns:
Number of symlinks updated
- Return type:
int
- update_exposure_group(project_uid: str, session_uid: str, exposure_group_id: int, /, body: ExposureGroupUpdate) ExposureGroup#
Configure a session 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#
Update Ab-Initio Reconstruction parameters for a 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#
Update 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#
Update streaming Homogenous Refinement job parameteres 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#
Update 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#
Update a session’s parameters. Unless
reprocessisFalse, resets exposures to a previous processing stage corresponding to the new params.- 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(body, *, type[, created_by_workflow])Create a new tag
delete(tag_uid, /)Delete a tag
find(*[, id, order, after, limit, ...])List tags that match the supplied filters (all if no filters specified).
Get a count of all tags by type
Get all tags, organized by type
update(tag_uid, /, body)Update tag title, colour and/or description
- create(body: CreateTag, *, type: Literal['general', 'project', 'workspace', 'session', 'job'], created_by_workflow: str | None = None) Tag#
Create a new tag
- delete(tag_uid: str, /) None#
Delete a tag
- Parameters:
tag_uid (str) – Tag UID, e.g., “T1”
- find(*, id: List[str] | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = None, created_by_user_id: str | None = None, type: List[Literal['general', 'project', 'workspace', 'session', 'job']] | None = None, uid: str | None = None) List[Tag]#
List tags that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Limit number of results to return, maximum limit is 1000. Defaults to None
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]#
Get a count of all tags by type
- Returns:
Successful Response
- Return type:
Dict[str, int]
- class UsersAPI#
Functions available in
api.users, e.g.,api.users.admin_exists(...)Methods:
Return True if there exists at least one user with admin privileges, False otherwise
count(*[, role])Counts the number of users in the system, optionally filtering by role
create([password, role])Create a new CryoSPARC user account.
delete(user_id, /)Remove a user from the CryoSPARC.
find(*[, role])List all users in the system, optionally filtering by role.
find_one(user_id, /)Find a user with a matching user ID or email
find_with_file_browser_access(*, path)List all users that have file browser access to the given path
get_file_browser_settings(user_id, /)Get a user's file browser settings, used to determine what file paths the user has access to in the CryoSPARC UI.
get_lanes(user_id, /)Get the lane names a user has access to
Get current user's file browser settings, used to determine what file paths the user has access to in the CryoSPARC UI.
Get the lane names the current user has access to
get_my_state_var(key, /)Retrieve a state variable value for the current user, such as "licenseAccepted" or "recentProjects".
get_role(user_id, /)Return "admin" if the user has admin privileges, "user" otherwise.
get_state_var(user_id, key, /)Retrieve a user state variable value, such as "licenseAccepted" or "recentProjects".
me()Get the current authenticated user
register(user_id, /, body, *, token)Register user with a token (unauthenticated).
request_reset_password(user_id, /)Generate a password reset token for a user with the given email.
reset_password(user_id, /, body, *, token)Reset password function with a previously-issued reset token (unauthenticated).
set_file_browser_settings(user_id, /, body)Update a user's file browser settings.
set_lanes(user_id, /, lanes)Restrict lanes the given user ID may to queue to.
set_role(user_id, /, role)Change a user's role from between "user" and "admin".
set_state_var(user_id, key, /, value)Set a user state variable such as "licenseAccepted" or "recentProjects"
table()Show a table of all CryoSPARC user accounts
unset_state_var(user_id, key, /)Delete a a user's state variable
update(user_id, /, *[, email, username, ...])Update a user's general details.
- admin_exists() bool#
Return True if there exists at least one user with admin privileges, False otherwise
- Returns:
Successful Response
- Return type:
bool
- count(*, role: Literal['admin', 'user'] | None = None) int#
Counts the number of users in the system, optionally filtering by role
- Parameters:
role (Literal['admin', 'user'], 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#
Create a new CryoSPARC user account. Only authenticated admins may do this. If providing a password, first hash the password with SHA256.
- 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#
Remove a user from the CryoSPARC. Note that projects created by the user are not deleted. Only authenticated admins may do this.
- Parameters:
user_id (str) – User ID or Email Address
- find(*, role: Literal['admin', 'user'] | None = None) List[User]#
List all users in the system, optionally filtering by role. Only admins may access this function.
- Parameters:
role (Literal['admin', 'user'], optional) – Defaults to None
- Returns:
Successful Response
- Return type:
List[User]
- find_one(user_id: str, /) User#
Find a user with a matching user ID or email
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
Successful Response
- Return type:
- find_with_file_browser_access(*, path: str) List[User]#
List all users that have file browser access to the given path
- Parameters:
path (str)
- Returns:
Successful Response
- Return type:
List[User]
- get_file_browser_settings(user_id: str, /) FileBrowserSettings#
Get a user’s file browser settings, used to determine what file paths the user has access to in the CryoSPARC UI.
- Parameters:
user_id (str) – User ID or Email Address
- Returns:
User file browser settings
- Return type:
- get_lanes(user_id: str, /) List[str]#
Get 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_file_browser_settings() FileBrowserSettings#
Get current user’s file browser settings, used to determine what file paths the user has access to in the CryoSPARC UI.
- Returns:
User file browser settings
- Return type:
- get_my_lanes() List[str]#
Get the lane names the current user has access to
- Returns:
Successful Response
- Return type:
List[str]
- get_my_state_var(key: str, /) Any#
Retrieve a state variable value for the current user, such as “licenseAccepted” or “recentProjects”.
- Parameters:
key (str)
- Returns:
Successful Response
- Return type:
Any
- get_role(user_id: str, /) Literal['user', 'admin']#
Return “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#
Retrieve a user state variable value, 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#
Register user with a token (unauthenticated). Password must be hashed with SHA256.
- Parameters:
user_id (str) – User ID or Email Address
body (SHA256Password)
token (str)
- request_reset_password(user_id: str, /) None#
Generate 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#
Reset password function with a previously-issued reset token (unauthenticated). Password must be hashed with SHA256.
- Parameters:
user_id (str) – User ID or Email Address
body (SHA256Password)
token (str)
- set_file_browser_settings(user_id: str, /, body: FileBrowserSettings) User#
Update a user’s file browser settings. Only admins may access this function.
- Parameters:
user_id (str) – User ID or Email Address
body (FileBrowserSettings)
- 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 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#
Change a user’s role from between “user” and “admin”. Only admins may do this. This revokes all access tokens for the target user.
- 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#
Set a user state variable such as “licenseAccepted” or “recentProjects”
- 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#
Delete a a user’s state variable
- 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#
Update a user’s general details. Parameters left empty will be left unchanged. Users can always change their own details, but only admins can change other users’ details.
- 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.find(...)Methods:
apply(body, *, project_uid, workspace_uid)Apply a workflow to a workspace
create(body, *[, forked, rebuilt])Create a workflow
delete(workflow_id, /)Delete a workflow
edit(workflow_id, /, body)Update a workflow.
find(*[, id, title, category, created_by, ...])List workflows that match the supplied filters (all if no filters specified).
find_one(workflow_id, /)Get a workflow by its id
set_job_param(workflow_id, workflow_juid, ...)Set a parameter on a job in a workflow
- apply(body: ApplyWorkflowRequest, *, project_uid: str, workspace_uid: str) None#
Apply a workflow to a workspace
- Parameters:
body (ApplyWorkflowRequest)
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- delete(workflow_id: str, /) None#
Delete a workflow
- Parameters:
workflow_id (str)
- edit(workflow_id: str, /, body: UpdateWorkflow) Workflow#
Update a workflow.
- Parameters:
workflow_id (str)
body (UpdateWorkflow)
- Returns:
Successful Response
- Return type:
- find(*, id: List[str] | None = None, title: str | None = None, category: List[str] | None = None, created_by: List[str] | None = None, pinned: bool | None = None, created_at: Tuple[datetime, datetime] | None = None, updated_at: Tuple[datetime, datetime] | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Workflow]#
List workflows that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
title (str, optional) – Defaults to None
category (List[str], optional) – Defaults to None
created_by (List[str], optional) – Defaults to None
pinned (bool, 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
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
List[Workflow]
- find_one(workflow_id: str, /) Workflow#
Get a workflow by its id
- Parameters:
workflow_id (str)
- Returns:
Successful Response
- Return type:
- set_job_param(workflow_id: str, workflow_juid: str, param: str, /, body: WorkflowParameter) WorkflowJob#
Set a parameter on a job in a workflow
- Parameters:
workflow_id (str)
workflow_juid (str)
param (str)
body (WorkflowParameter)
- Returns:
Successful Response
- Return type:
- 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(*[, id, uid, project_uid, created_at, ...])Count workspaces that match the supplied filters (all if no filters specified).
create(project_uid, /, *, title[, description])Create a new empty workspace.
delete(project_uid, workspace_uid, /)Initiate a workspace deletion.
find(*[, id, uid, project_uid, created_at, ...])List workspaces that match the supplied filters (all if no filters specified).
find_one(project_uid, workspace_uid, /)Find a workspace in a project by its unique ID.
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.
preview_split(project_uid, workspace_uid, /)Preview which jobs, sessions, and workspaces would be included in a split call.
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
split(project_uid, workspace_uid, /, *[, title])Create a new project at target_dir containing the specified jobs and their external parent jobs.
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, /)Add a workspace to a user's recently viewed workspaces list.
- add_tag(project_uid: str, workspace_uid: str, tag_uid: str, /) Workspace | Session#
Tag the given workspace with the given tag.
- 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(*, id: List[str] | None = None, 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, deleting: bool | None = None) int#
Count workspaces that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
deleting (bool, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
int
- create(project_uid: str, /, *, title: str, description: str | None = None) Workspace#
Create a new empty workspace.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
title (str)
description (str, optional) – Defaults to None
- Returns:
Successful Response
- Return type:
- delete(project_uid: str, workspace_uid: str, /) None#
Initiate a workspace deletion. This deletes the workspace and any jobs exclusively in the workspace.
Workspace jobs with the following conditions are never deleted: - Linked to other workspaces (unlinked instead) - Have “final” or “ancestor of final” status - Have descendants in other workspaces.
If the workspace cannot be emptied due to these conditions, it is not marked as deleted.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
- find(*, id: List[str] | None = None, 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, deleting: bool | None = None, order: Literal[-1, 1] = 1, after: str | None = None, limit: int | None = 100) List[Workspace | Session]#
List workspaces that match the supplied filters (all if no filters specified).
- Parameters:
id (List[str], optional) – Defaults to None
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
deleting (bool, optional) – Defaults to None
order (Literal[-1, 1], optional) – 1 for ascending order, -1 for descending order. Defaults to 1
after (str, optional) – Cursor for pagination; only return results with id greater than (if order=1) or less than (if order=-1) this value. Defaults to None
limit (int, optional) – Defaults to 100
- Returns:
Successful Response
- Return type:
- find_one(project_uid: str, workspace_uid: str, /) Workspace | Session#
Find a workspace in a project by its unique ID.
- 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:
- preview_split(project_uid: str, workspace_uid: str, /) SplitProjectPreview#
Preview which jobs, sessions, and workspaces would be included in a split call.
- 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 | Session#
Removes a tag from a workspace.
- set_description(project_uid: str, workspace_uid: str, /, description: str = '') Workspace | Session#
Set description of a workspace
- set_title(project_uid: str, workspace_uid: str, /, *, title: str) Workspace | Session#
Set title of a workspace
- split(project_uid: str, workspace_uid: str, /, *, title: str | None = None, parent_dir: str) None#
Create a new project at target_dir containing the specified jobs and their external parent jobs.
- Parameters:
project_uid (str) – Project UID, e.g., “P3”
workspace_uid (str) – Workspace UID, e.g., “W3”
title (str, optional) – Defaults to None
parent_dir (str)
- star_workspace(project_uid: str, workspace_uid: str, /) Workspace | Session#
Stars a workspace for a user