Allow depending on tasks from an earlier submit in the jobfile#1031
Allow depending on tasks from an earlier submit in the jobfile#1031Kobzol wants to merge 1 commit intoIt4innovations:mainfrom
Conversation
61e1188 to
efb657c
Compare
Yes, Tako checks this, so in the case race condition. the second submit gets an error. I will do a proper code review tomorrow. |
| while idx < new_tasks.len() { | ||
| if let Some(consumers) = consumers.get(&new_tasks[idx].id) { | ||
|
|
||
| let mut handle_consumers = |
There was a problem hiding this comment.
I think that there is no need to construct "deps_from_previous_submit", you just need to check that tasks already exists (ID exits) and then forget it. You just need to modify the check for emptiness of deps. When all deps depends only on previously existing tasks, then you can put it immediately into new_tasks. Then there is no need to process anything like "deps_from_previous_submit" with handle_consumers.
(This is written from a hospital bed, so I may be wrong:)
There was a problem hiding this comment.
Good point, it's a nice simplification. It needed a few more changes, but it's better this way, I think.
efb657c to
940e9ed
Compare
| } | ||
|
|
||
| let task_deps_from_this_submit: Vec<JobTaskId> = t | ||
| .task_deps |
There was a problem hiding this comment.
Note: this could be
.iter()
.filter(|&task| !existing_tasks.contains(task))
.copied()
.collect();But I think that pre-cloning might be better to avoid partial reallocations of the Vec, since the usual case is that all/most deps will be from the same submit.
|
Maybe we can avoid creating |
We should be checking the validity of the tasks on the server too, as doing it on the client can cause race conditions, in theory. But even if that happens, the server will reject the submit anyway, I suppose.