|
16 | 16 | JobProgressUpdate, |
17 | 17 | JobStatusUpdate, |
18 | 18 | JobSubmission, |
19 | | - JobCancel, |
| 19 | + JobDelete, |
20 | 20 | ) |
21 | 21 | from omotes_sdk_protocol.workflow_pb2 import AvailableWorkflows, RequestAvailableWorkflows |
22 | 22 |
|
@@ -372,21 +372,28 @@ def submit_job( |
372 | 372 |
|
373 | 373 | return job |
374 | 374 |
|
375 | | - def cancel_job(self, job: Job) -> None: |
376 | | - """Cancel a job. |
| 375 | + def delete_job(self, job: Job) -> None: |
| 376 | + """Delete a job and all of its resources. |
377 | 377 |
|
378 | | - If this succeeds or not will be send as a job status update through the |
379 | | - `callback_on_status_update` handler. This method will not disconnect from the submitted job |
380 | | - events. This will need to be done separately using `disconnect_from_submitted_job`. |
| 378 | + This will delete the job regardless of its current state. If it is running, it will be |
| 379 | + cancelled. If the job produced any timeseries data, it will be deleted eventually. |
381 | 380 |
|
382 | | - :param job: The job to cancel. |
| 381 | + Developers note: |
| 382 | + If the jobs is successfully cancelled or not will be sent as a job status update through |
| 383 | + the `callback_on_status_update` handler. This method will not disconnect from the submitted |
| 384 | + job events. This will need to be done separately using `disconnect_from_submitted_job` |
| 385 | + after receiving the job status update. |
| 386 | + Deletion of the timeseries is done by the orchestrator. See: |
| 387 | + https://github.com/Project-OMOTES/architecture-documentation/blob/main/Feature_Time_Series_DB_Cleanup/Feature_Time_Series_DB_Cleanup.md |
| 388 | +
|
| 389 | + :param job: The job to delete. |
383 | 390 | """ |
384 | | - logger.info("Cancelling job %s", job.id) |
385 | | - cancel_msg = JobCancel(uuid=str(job.id)) |
| 391 | + logger.info("Deleting job %s", job.id) |
| 392 | + delete_msg = JobDelete(uuid=str(job.id)) |
386 | 393 | self.broker_if.send_message_to( |
387 | 394 | exchange_name=OmotesQueueNames.omotes_exchange_name(), |
388 | | - routing_key=OmotesQueueNames.job_cancel_queue_name(), |
389 | | - message=cancel_msg.SerializeToString(), |
| 395 | + routing_key=OmotesQueueNames.job_delete_queue_name(), |
| 396 | + message=delete_msg.SerializeToString(), |
390 | 397 | ) |
391 | 398 |
|
392 | 399 | def connect_to_available_workflows_updates(self) -> None: |
|
0 commit comments