diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 613fc88e4a3c..50bfcea0b6b3 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -4190,7 +4190,7 @@ export interface components { * Command Version * @description Tool version indicated during job execution. */ - command_version: string; + command_version?: string; /** * Copied from Job-ID * @description Reference to cached job if job execution was cached. @@ -4218,7 +4218,7 @@ export interface components { * @description The (major) version of Galaxy used to create this job. * @example 21.05 */ - galaxy_version: string; + galaxy_version?: string; /** * History ID * @description The encoded ID of the history associated with this item. @@ -6631,7 +6631,7 @@ export interface components { * @description The (major) version of Galaxy used to create this job. * @example 21.05 */ - galaxy_version: string; + galaxy_version?: string; /** * History ID * @description The encoded ID of the history associated with this item. @@ -6756,6 +6756,12 @@ export interface components { */ value: string; }; + /** + * JobMetricCollection + * @description Collections of metrics provided by `JobInstrumenter` plugins on a particular job. + * @default [] + */ + JobMetricCollection: components["schemas"]["JobMetric"][]; /** JobOutput */ JobOutput: { /** @@ -9020,6 +9026,163 @@ export interface components { */ short_term_storage_request_id: string; }; + /** + * ShowFullJobResponse + * @description Basic information about a job. + */ + ShowFullJobResponse: { + /** + * Command Line + * @description The command line produced by the job. Users can see this value if allowed in the configuration, administrator can always see this value. + */ + command_line?: string; + /** + * Command Version + * @description Tool version indicated during job execution. + */ + command_version?: string; + /** + * Copied from Job-ID + * @description Reference to cached job if job execution was cached. + * @example 0123456789ABCDEF + */ + copied_from_job_id?: string; + /** + * Create Time + * Format: date-time + * @description The time and date this item was created. + */ + create_time: string; + /** + * Job dependencies + * @description The dependencies of the job. + */ + dependencies?: Record[]; + /** + * Exit Code + * @description The exit code returned by the tool. Can be unset if the job is not completed yet. + */ + exit_code?: number; + /** + * External ID + * @description The job id used by the external job runner (Condor, Pulsar, etc.)Only administrator can see this value. + */ + external_id?: string; + /** + * Galaxy Version + * @description The (major) version of Galaxy used to create this job. + * @example 21.05 + */ + galaxy_version?: string; + /** + * History ID + * @description The encoded ID of the history associated with this item. + * @example 0123456789ABCDEF + */ + history_id?: string; + /** + * ID + * @description The encoded ID of this entity. + * @example 0123456789ABCDEF + */ + id: string; + /** + * Inputs + * @description Dictionary mapping all the tool inputs (by name) to the corresponding data references. + * @default {} + */ + inputs?: { + [key: string]: components["schemas"]["EncodedDatasetJobInfo"] | undefined; + }; + /** + * Job Messages + * @description List with additional information and possible reasons for a failed job. + */ + job_messages?: Record[]; + /** + * Job Metrics + * @description Collections of metrics provided by `JobInstrumenter` plugins on a particular job. Only administrators can see these metrics. + */ + job_metrics?: components["schemas"]["JobMetricCollection"]; + /** + * Job Standard Error + * @description The captured standard error of the job execution. + */ + job_stderr?: string; + /** + * Job Standard Output + * @description The captured standard output of the job execution. + */ + job_stdout?: string; + /** + * Model class + * @description The name of the database model class. + * @default Job + * @enum {string} + */ + model_class: "Job"; + /** + * Output collections + * @default {} + */ + output_collections?: { + [key: string]: components["schemas"]["EncodedHdcaSourceId"] | undefined; + }; + /** + * Outputs + * @description Dictionary mapping all the tool outputs (by name) to the corresponding data references. + * @default {} + */ + outputs?: { + [key: string]: components["schemas"]["EncodedDatasetJobInfo"] | undefined; + }; + /** + * Parameters + * @description Object containing all the parameters of the tool associated with this job. The specific parameters depend on the tool itself. + */ + params: Record; + /** + * State + * @description Current state of the job. + */ + state: components["schemas"]["JobState"]; + /** + * Standard Error + * @description Combined tool and job standard error streams. + */ + stderr?: string; + /** + * Standard Output + * @description Combined tool and job standard output streams. + */ + stdout?: string; + /** + * Tool ID + * @description Identifier of the tool that generated this job. + */ + tool_id: string; + /** + * Tool Standard Error + * @description The captured standard error of the tool executed by the job. + */ + tool_stderr?: string; + /** + * Tool Standard Output + * @description The captured standard output of the tool executed by the job. + */ + tool_stdout?: string; + /** + * Update Time + * Format: date-time + * @description The last time and date this item was updated. + */ + update_time: string; + /** + * User Email + * @description The email of the user that owns this job. Only the owner of the job and administrators can see this value. + */ + user_email?: string; + }; /** * Src * @description An enumeration. @@ -15792,7 +15955,9 @@ export interface operations { /** @description Successful Response */ 200: { content: { - "application/json": Record; + "application/json": + | components["schemas"]["ShowFullJobResponse"] + | components["schemas"]["EncodedJobDetails"]; }; }; /** @description Validation Error */ diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index 52918694e7df..b664c3cafa4f 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -1550,6 +1550,7 @@ def _set_job_attributes( "tool_stderr", "job_stdout", "job_stderr", + "galaxy_version", ) for attribute in ATTRIBUTES: value = job_attrs.get(attribute) diff --git a/lib/galaxy/schema/jobs.py b/lib/galaxy/schema/jobs.py index 37cd7af3d41f..ce5dc6f2b2c2 100644 --- a/lib/galaxy/schema/jobs.py +++ b/lib/galaxy/schema/jobs.py @@ -23,6 +23,7 @@ DataItemSourceType, EncodedDataItemSourceId, EntityIdField, + JobMetricCollection, JobState, JobSummary, Model, @@ -158,7 +159,7 @@ class EncodedDatasetJobInfo(EncodedDataItemSourceId): class EncodedJobDetails(JobSummary): command_version: Optional[str] = Field( - ..., + default=None, title="Command Version", description="Tool version indicated during job execution.", ) @@ -181,9 +182,15 @@ class EncodedJobDetails(JobSummary): description="Dictionary mapping all the tool outputs (by name) to the corresponding data references.", ) copied_from_job_id: Optional[EncodedDatabaseIdField] = Field( - default=None, title="Copied from Job-ID", description="Reference to cached job if job execution was cached." + default=None, + title="Copied from Job-ID", + description="Reference to cached job if job execution was cached.", + ) + output_collections: Dict[str, EncodedHdcaSourceId] = Field( + default={}, + title="Output collections", + description="", ) - output_collections: Dict[str, EncodedHdcaSourceId] = Field(default={}, title="Output collections", description="") class JobDestinationParams(Model): @@ -234,3 +241,54 @@ class JobDisplayParametersSummary(Model): title="Outputs", description="Dictionary mapping all the tool outputs (by name) with the corresponding dataset information in a nested format.", ) + + +class ShowFullJobResponse(EncodedJobDetails): + tool_stdout: Optional[str] = Field( + default=None, + title="Tool Standard Output", + description="The captured standard output of the tool executed by the job.", + ) + tool_stderr: Optional[str] = Field( + default=None, + title="Tool Standard Error", + description="The captured standard error of the tool executed by the job.", + ) + job_stdout: Optional[str] = Field( + default=None, + title="Job Standard Output", + description="The captured standard output of the job execution.", + ) + job_stderr: Optional[str] = Field( + default=None, + title="Job Standard Error", + description="The captured standard error of the job execution.", + ) + stdout: Optional[str] = Field( # Redundant? it seems to be (tool_stdout + "\n" + job_stdout) + default=None, + title="Standard Output", + description="Combined tool and job standard output streams.", + ) + stderr: Optional[str] = Field( # Redundant? it seems to be (tool_stderr + "\n" + job_stderr) + default=None, + title="Standard Error", + description="Combined tool and job standard error streams.", + ) + job_messages: Optional[List[Any]] = Field( + default=None, + title="Job Messages", + description="List with additional information and possible reasons for a failed job.", + ) + dependencies: Optional[List[Any]] = Field( + default=None, + title="Job dependencies", + description="The dependencies of the job.", + ) + job_metrics: Optional[JobMetricCollection] = Field( + default=None, + title="Job Metrics", + description=( + "Collections of metrics provided by `JobInstrumenter` plugins on a particular job. " + "Only administrators can see these metrics." + ), + ) diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index 6920fe5dbb94..5e1c1f44eae1 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -1851,8 +1851,8 @@ class JobBaseModel(Model): ) create_time: datetime = CreateTimeField update_time: datetime = UpdateTimeField - galaxy_version: str = Field( - ..., + galaxy_version: Optional[str] = Field( + default=None, title="Galaxy Version", description="The (major) version of Galaxy used to create this job.", example="21.05", diff --git a/lib/galaxy/webapps/galaxy/api/jobs.py b/lib/galaxy/webapps/galaxy/api/jobs.py index bd19370dd6ae..f54a23f30e1a 100644 --- a/lib/galaxy/webapps/galaxy/api/jobs.py +++ b/lib/galaxy/webapps/galaxy/api/jobs.py @@ -49,6 +49,7 @@ JobOutputAssociation, ReportJobErrorPayload, SearchJobsPayload, + ShowFullJobResponse, ) from galaxy.schema.schema import ( DatasetSourceType, @@ -500,8 +501,11 @@ def show( job_id: Annotated[DecodedDatabaseIdField, JobIdPathParam], full: Annotated[Optional[bool], FullShowQueryParam] = False, trans: ProvidesUserContext = DependsOnTrans, - ) -> Dict[str, Any]: - return self.service.show(trans, job_id, bool(full)) + ) -> Union[ShowFullJobResponse, EncodedJobDetails]: + if full: + return ShowFullJobResponse(**self.service.show(trans, job_id, bool(full))) + else: + return EncodedJobDetails(**self.service.show(trans, job_id, bool(full))) @router.delete( "/api/jobs/{job_id}", diff --git a/lib/galaxy_test/api/test_jobs.py b/lib/galaxy_test/api/test_jobs.py index af77499417d7..ccb15852ffd6 100644 --- a/lib/galaxy_test/api/test_jobs.py +++ b/lib/galaxy_test/api/test_jobs.py @@ -353,7 +353,7 @@ def test_show_security(self, history_id): assert not job_lock_response.json()["active"] show_jobs_response = self._get(f"jobs/{job_id}", admin=False) - self._assert_not_has_keys(show_jobs_response.json(), "external_id") + assert show_jobs_response.json()["external_id"] is None # TODO: Re-activate test case when API accepts privacy settings # with self._different_user(): @@ -361,7 +361,8 @@ def test_show_security(self, history_id): # self._assert_status_code_is( show_jobs_response, 200 ) show_jobs_response = self._get(f"jobs/{job_id}", admin=True) - self._assert_has_keys(show_jobs_response.json(), "command_line", "external_id") + assert show_jobs_response.json()["external_id"] is not None + assert show_jobs_response.json()["command_line"] is not None def _run_detect_errors(self, history_id, inputs): payload = self.dataset_populator.run_tool_payload(