Skip to content

Commit

Permalink
fix(tools): correct api type names
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrasser committed Jan 8, 2025
1 parent 168f3a3 commit 26547ab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
13 changes: 7 additions & 6 deletions cryosparc/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class FilesNamespace(APINamespace):
] = ...,
) -> GridFSAsset:
"""
Upload a new assest associated with the given project/job. When calling
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.
"""
Expand Down Expand Up @@ -456,11 +456,12 @@ class JobsNamespace(APINamespace):
def delete(self, project_uid: str, job_uid: str, /, *, force: bool = False) -> Job: ...
def get_directory(self, project_uid: str, job_uid: str, /) -> str: ...
def get_log(self, project_uid: str, job_uid: str, /) -> str: ...
def get_log_path(self, project_uid: str, job_uid: str, /) -> str: ...
def get_input_specs(self, project_uid: str, job_uid: str, /) -> InputSpecs: ...
def get_input_spec(self, project_uid: str, job_uid: str, input_name: str, /) -> InputSpec: ...
def add_input(self, project_uid: str, job_uid: str, input_name: str, /, body: InputSpec) -> Job:
def add_external_input(self, project_uid: str, job_uid: str, input_name: str, /, body: InputSpec) -> Job:
"""
Add or replace an input in an external job.
Add or replace an job's input. Currently only works for external jobs.
"""
...
def get_output_specs(self, project_uid: str, job_uid: str, /) -> OutputSpecs: ...
Expand All @@ -472,9 +473,9 @@ class JobsNamespace(APINamespace):
"""
...
def get_output_spec(self, project_uid: str, job_uid: str, output_name: str, /) -> OutputSpec: ...
def add_output(self, project_uid: str, job_uid: str, output_name: str, /, body: OutputSpec) -> Job:
def add_external_output(self, project_uid: str, job_uid: str, output_name: str, /, body: OutputSpec) -> Job:
"""
Add or replace an output in an external job.
Add or replace an job's output. Currently only works for external jobs.
"""
...
def create_external_result(
Expand Down Expand Up @@ -607,7 +608,7 @@ class JobsNamespace(APINamespace):
self, project_uid: str, job_uid: str, /, text: str, *, type: Literal["text", "warning", "error"] = "text"
) -> TextEvent: ...
def get_event_logs(
self, project_uid: str, job_uid: str, /
self, project_uid: str, job_uid: str, /, *, checkpoint: Optional[int] = ...
) -> List[Union[Event, CheckpointEvent, TextEvent, ImageEvent, InteractiveEvent]]: ...
def add_image_log(
self, project_uid: str, job_uid: str, /, images: List[GridFSAsset], *, text: str, flags: List[str] = ["plots"]
Expand Down
4 changes: 2 additions & 2 deletions cryosparc/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ def add_input(
name = type
if not title:
title = name
self.model = self.cs.api.jobs.add_input(
self.model = self.cs.api.jobs.add_external_input(
self.project_uid,
self.uid,
name,
Expand Down Expand Up @@ -1318,7 +1318,7 @@ def add_output(
name = type
if not title:
title = name
self.model = self.cs.api.jobs.add_output(
self.model = self.cs.api.jobs.add_external_output(
self.project_uid,
self.uid,
name,
Expand Down
2 changes: 1 addition & 1 deletion cryosparc/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Job(BaseModel):
job_dir_size_last_updated: Optional[datetime.datetime] = None
run_as_user: Optional[str] = None
title: str = ""
description: str = "Enter a description."
description: str = ""
status: JobStatus = "building"
created_by_user_id: Optional[str] = None
created_by_job_uid: Optional[str] = None
Expand Down
2 changes: 1 addition & 1 deletion tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def mock_external_job_with_saved_output(external_job_with_added_output: External


def test_external_job_output(mock_external_job_with_saved_output: ExternalJobController):
assert isinstance(mock_add_output_endpoint := APIClient.jobs.add_output, mock.Mock)
assert isinstance(mock_add_output_endpoint := APIClient.jobs.add_external_output, mock.Mock)
assert isinstance(mock_save_output_endpoint := APIClient.jobs.save_output, mock.Mock)
j = mock_external_job_with_saved_output

Expand Down

0 comments on commit 26547ab

Please sign in to comment.