Factor out logic about how pgroups are assigned

Introduce pgroup_provenance_t, a type which captures "where the pgroup
comes from." This centralizes some logic around how pgroups are
assigned, and it anticipates concurrent execution.
This commit is contained in:
ridiculousfish
2020-01-29 16:39:44 -08:00
parent d22c6af7a3
commit 10da6df506
5 changed files with 117 additions and 65 deletions

View File

@@ -1302,6 +1302,9 @@ end_execution_reason_t parse_execution_context_t::run_1_job(tnode_t<g::job> job_
// Clean up the job on failure or cancellation.
if (pop_result == end_execution_reason_t::ok) {
// Set the pgroup assignment mode, now that the job is populated.
job->pgroup_mode = get_pgroup_provenance(job, lineage);
// Success. Give the job to the parser - it will clean it up.
parser->job_add(job);