diff --git a/cryosparc/controllers/job.py b/cryosparc/controllers/job.py index de4dd961..d589c2a3 100644 --- a/cryosparc/controllers/job.py +++ b/cryosparc/controllers/job.py @@ -320,6 +320,24 @@ def clear(self): """ self.model = self.cs.api.jobs.clear(self.project_uid, self.uid) + def set_title(self, title: str): + """ + Set the job title. + + Args: + title (str): New job title + """ + self.model = self.cs.api.jobs.set_title(self.project_uid, self.uid, title=title) + + def set_description(self, desc: str): + """ + Set the job description. May include Markdown formatting. + + Args: + desc (str): New job description + """ + self.model = self.cs.api.jobs.set_description(self.project_uid, self.uid, description=desc) + def set_param(self, name: str, value: Any, **kwargs) -> bool: """ Set the given param name on the current job to the given value. Only diff --git a/cryosparc/controllers/project.py b/cryosparc/controllers/project.py index cae9f47d..72b478b7 100644 --- a/cryosparc/controllers/project.py +++ b/cryosparc/controllers/project.py @@ -73,6 +73,24 @@ def dir(self) -> PurePosixPath: """Full path to project directory.""" return PurePosixPathProperty(self.cs.api.projects.get_directory(self.uid)) + def set_title(self, title: str): + """ + Set the project title. + + Args: + title (str): New project title + """ + self.model = self.cs.api.projects.set_title(self.uid, title=title) + + def set_description(self, desc: str): + """ + Set the project description. May include Markdown formatting. + + Args: + desc (str): New project description + """ + self.model = self.cs.api.projects.set_description(self.uid, description=desc) + def find_workspaces(self, *, order: Literal[1, -1] = 1) -> Iterable[WorkspaceController]: """ Get all workspaces available in the current project. diff --git a/cryosparc/controllers/workspace.py b/cryosparc/controllers/workspace.py index 7cbb43f3..5a16f44b 100644 --- a/cryosparc/controllers/workspace.py +++ b/cryosparc/controllers/workspace.py @@ -70,6 +70,24 @@ def refresh(self): self.model = self.cs.api.workspaces.find_one(self.project_uid, self.uid) return self + def set_title(self, title: str): + """ + Set the workspace title. + + Args: + title (str): New workspace title + """ + self.model = self.cs.api.workspaces.set_title(self.project_uid, self.uid, title=title) + + def set_description(self, desc: str): + """ + Set the workspace description. May include Markdown formatting. + + Args: + desc (str): New workspace description + """ + self.model = self.cs.api.workspaces.set_description(self.project_uid, self.uid, description=desc) + def find_jobs(self, *, order: Literal[1, -1] = 1, **search: Unpack[JobSearch]) -> Iterable[JobController]: """ Search jobs in the current workspace.