Error when connecting to interactve job using cryosparc_tools API

Dear cryoSPARC team,
I am happily working my way through the workflow example using the cryosparc_tools API. Most of the functions work and I was able to submit a workflow-tree of jobs.
I came across an error when trying to interact with a Job-object as described in the custom-workflow.ipynb.
Here my simple test case for a “Manual Curate Exposure”-type job “J133” in project “P80”.
The job was created and submitted to the lane in the front-end.

cs = CryoSPARC(...)
j133 = cs.find_job("P80","J133")
j133
>>> <cryosparc.job.Job object at 0x7fe8fc40e320>
j133.status
>>> 'waiting'

So the job is existing, but the method “.interact()” is not available.

data = j133.interact("get_fields_and_thresholds")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Job' object has no attribute 'interact'

I had the same error of “interact” not being an attribute when creating the job via the API.
I am using cryosparc 4.2.0 and cryosparc_tools 4.2.0.
I found that when installing cryosparc_tools via pip the interact method is not present in the job.py module. Could it be that the pip command is not using the latest GitHub version?
Thanks for your help in advance.

List of methods available for a job-type object

j133.
j133.clear() j133.dir() j133.download_asset( j133.kill() j133.load_output( j133.mkdir( j133.set_param( j133.uid j133.upload_mrc(
j133.connect( j133.disconnect( j133.download_dataset( j133.list_assets() j133.log( j133.project_uid j133.status j133.upload( j133.upload_plot(
j133.cp( j133.doc j133.download_file( j133.list_files( j133.log_checkpoint( j133.queue( j133.subprocess( j133.upload_asset( j133.wait_for_done(
j133.cs j133.download( j133.download_mrc( j133.load_input( j133.log_plot( j133.refresh() j133.symlink( j133.upload_dataset( j133.wait_for_status(

Very likely you have encountered a feature that is present in the latest github comments, but not yet present in the current pip-installable release of cryosparc-tools. A new release of cryosparc-tools will become available soon.

2 Likes

Thanks for answer. Is there a way to install the latest version from github as well?

Here are the the steps suggested by a member of the Structura team:

  1. Activate a python 3.7 ≤ version ≤ 3.10 environment that includes the dependencies, other than cryosparc-tools, that you require for your code.

  2. git clone --recursive https://github.com/cryoem-uoft/cryosparc-tools.git
    
  3. cd cryosparc-tools

  4. pip install -e .

1 Like

Thanks. I did it and installed the latest cryosparc-tools version (develop, commit 1b99aab224).
The interact() job is working now, but I get an error for the job creation now.
The “desc” argument on make_job is unexpected.

When switching between cryosparc-tools version I can create a job (PIP version) and interact with it (develop version). But I should be possible to do it in the same version, right?

I would assume that cryosparc-tools (develop) is using some newer/additional arguments that require cryosparc 4.2.1. Since we are running on 4.2.0 I will update to 4.2.1 soon and test again.

Can I assume that cryosparc-tools will always be build for the latest stable cryosparc version, so 4.2.1 right now?

Thanks
Ferdinand

Error log

>>> python cs_dev_test.py 
Connection to CryoSPARC was established successfully. 
Starting CTF curation
Traceback (most recent call last):
  File "/xxx/xxx/cs_dev_test.py", line 26, in <module>
    curate_exposures_job = workspace.create_job(
  File "/xxx/xxx/software/cryosparc-tools/cryosparc/workspace.py", line 99, in create_job
    return self.cs.create_job(
  File "/xxx/xxx/software/cryosparc-tools/cryosparc/tools.py", line 358, in create_job
    job_uid: str = self.cli.make_job(  # type: ignore
  File "/xxx/xxx/software/cryosparc-tools/cryosparc/command.py", line 113, in func
    assert "error" not in res, f'Error for "{key}" with params {params}:\n' + format_server_error(res["error"])
AssertionError: Error for "make_job" with params {'job_type': 'curate_exposures_v2', 'project_uid': 'P80', 'workspace_uid': 'W2', 'user_id': '647deb8a28a8c92e11734fc0', 'title': None, 'desc': None, 'params': {}, 'input_group_connects': {'exposures': ['J135.exposures']}}:
ServerError: make_job() got an unexpected keyword argument 'desc'
Traceback (most recent call last):
  File "/opt/cryosparc/cryosparc_master/cryosparc_command/commandcommon.py", line 200, in wrapper
    res = func(*args, **kwargs)
  File "/opt/cryosparc/cryosparc_master/cryosparc_command/commandcommon.py", line 266, in wrapper
    return func(*args, **kwargs)
TypeError: make_job() got an unexpected keyword argument 'desc'

Correct. It is expected that the current release of cryosparc-tools is compatible with

Any malfunction of cryosparc-tools under the above conditions could be a bug in either cryosparc-tools and/or CryoSPARC and/or the documentation.
A concrete example what should or should not work: As of July 18, 2023,

  • the release of cryosparc-tools is v4.2.0
  • the release of CryoSPARC is v4.2.1
  • cryosparc-tools v4.2.0 supports CryoSPARC release v4.2.0 and v4.2.1
  • tools.cryosparc.com describes cryosparc-tools v4.2.0
  • the HEAD of the cryosparc-tools develop branch is not compatible with CryoSPARC v4.2.1
  • docs/ at the HEAD of the cryosparc-tools develop branch is not compatible with cryosparc-tools v4.2.0
1 Like