-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Add job cancellation for early stop of the job execution. #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 36 commits
f959ef3
8a3ef43
a79dff1
80e27cb
f7fa1d7
9aced17
2198185
25e9b3f
4292d46
6a1f9e0
e4c8f99
127cd74
d964d67
2e2ddf8
1a724ce
4b59d39
c79eefc
f3cb222
7342925
5e841f8
a988751
a58f58e
23d94ff
d9e837f
24563ce
f1afa62
afbf6b9
e2cad8f
a55ffac
709422d
228d32a
b351b11
6711918
134c811
9a33bbd
17dd4df
1f4160b
31a1579
670864c
f500c1a
bef31da
216913e
594f32e
623ee0e
5b8ab01
cd55a1e
62976a2
89b2813
c0f533f
e2a2ea6
f7b36bb
1d20f50
7368900
2f9d378
1bee529
8ebdfd1
10bd8ff
a344f88
8672fd8
9fa0884
573a74b
2afd0e2
40e5fb5
b65d187
e4da187
18ce4e9
8015388
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
sitaowang1998 marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,41 @@ class MetadataStorage { | |
| std::vector<boost::uuids::uuid>* job_ids | ||
| ) -> StorageErr | ||
| = 0; | ||
| /** | ||
| * Cancel a job. This will set the job state to CANCEL and set all tasks that have not | ||
| * finished or started to CANCEL. | ||
| * @param conn | ||
| * @param id The job id. | ||
| * @return The error code. | ||
| */ | ||
| virtual auto cancel_job(StorageConnection& conn, boost::uuids::uuid id) -> StorageErr = 0; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also have an error message parameter here right?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't fully understand. Are you saying a client cannot set a message (maybe because it is a cli command or something)? If this is the case, it makes sense to not have it as a parameter, but we should still set the error message to something fixed (e.g. "Job cancellation requested by client.") inside cancel_job. Also, please improve the docstrings so the difference between cancel_job and cancel_job_by_task is more clear (e.g. the different use cases). |
||
| /** | ||
| * Cancel a job that owns the task. This will set the job state to CANCEL and set all tasks | ||
| * that have not finished or started to CANCEL. | ||
| * @param conn | ||
| * @param id The task id. | ||
| * @param message The error message of the cancellation. | ||
| * @return The error code. | ||
| */ | ||
| virtual auto | ||
| cancel_job_by_task(StorageConnection& conn, boost::uuids::uuid id, std::string const& message) | ||
| -> StorageErr | ||
|
sitaowang1998 marked this conversation as resolved.
Outdated
|
||
| = 0; | ||
| /** | ||
| * Get the error message of a cancelled job. | ||
| * @param conn | ||
| * @param id The job id. | ||
| * @param function_name The function name of the cancelled task. | ||
| * @param message The error message of the cancellation. | ||
| * @return The error code. | ||
| */ | ||
| virtual auto get_job_message( | ||
|
sitaowang1998 marked this conversation as resolved.
Outdated
|
||
| StorageConnection& conn, | ||
| boost::uuids::uuid id, | ||
| std::string* function_name, | ||
| std::string* message | ||
| ) -> StorageErr | ||
| = 0; | ||
| virtual auto remove_job(StorageConnection& conn, boost::uuids::uuid id) -> StorageErr = 0; | ||
| virtual auto reset_job(StorageConnection& conn, boost::uuids::uuid id) -> StorageErr = 0; | ||
| virtual auto add_child(StorageConnection& conn, boost::uuids::uuid parent_id, Task const& child) | ||
|
|
@@ -92,6 +127,9 @@ class MetadataStorage { | |
| virtual auto set_task_state(StorageConnection& conn, boost::uuids::uuid id, TaskState state) | ||
| -> StorageErr | ||
| = 0; | ||
| virtual auto get_task_state(StorageConnection& conn, boost::uuids::uuid id, TaskState* state) | ||
| -> StorageErr | ||
| = 0; | ||
| virtual auto set_task_running(StorageConnection& conn, boost::uuids::uuid id) -> StorageErr = 0; | ||
| virtual auto add_task_instance(StorageConnection& conn, TaskInstance const& instance) | ||
| -> StorageErr | ||
|
|
||
|
sitaowang1998 marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.