ci/run_n_monitor: Add --exclude-stage filtering
Add an argument to ci_run_n_monitor specifying certain stages to be excluded from consideration, defaulting to the one with post-merge and performance jobs. This allows, e.g., to run all Panfrost pre-merge jobs: ./ci_run_n_monitor.py --target 'panfrost.*' or to run all Freedreno pre-merge jobs: ./ci_run_n_monitor.py --target '.*' --include-stage freedreno Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30784>
This commit is contained in:
@@ -325,13 +325,17 @@ def create_job_needs_dag(gl_gql: GitlabGQL, params, disable_cache: bool = True)
|
||||
return final_dag
|
||||
|
||||
|
||||
def filter_dag(dag: Dag, job_name_regex: Pattern, include_stage_regex: Pattern) -> Dag:
|
||||
def filter_dag(
|
||||
dag: Dag, job_name_regex: Pattern, include_stage_regex: Pattern, exclude_stage_regex: Pattern
|
||||
) -> Dag:
|
||||
filtered_jobs: Dag = Dag({})
|
||||
for (job, data) in dag.items():
|
||||
if not job_name_regex.fullmatch(job):
|
||||
continue
|
||||
if not include_stage_regex.fullmatch(data["stage"]):
|
||||
continue
|
||||
if exclude_stage_regex.fullmatch(data["stage"]):
|
||||
continue
|
||||
filtered_jobs[job] = data
|
||||
return filtered_jobs
|
||||
|
||||
@@ -488,6 +492,13 @@ def parse_args() -> Namespace:
|
||||
default=".*",
|
||||
help="Regex pattern for the stage name to be considered",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude-stage",
|
||||
type=str,
|
||||
required=False,
|
||||
default="^$",
|
||||
help="Regex pattern for the stage name to be excluded",
|
||||
)
|
||||
mutex_group_print = parser.add_mutually_exclusive_group()
|
||||
mutex_group_print.add_argument(
|
||||
"--print-dag",
|
||||
@@ -529,7 +540,7 @@ def main():
|
||||
gl_gql, {"projectPath": args.project_path, "iid": iid}, disable_cache=True
|
||||
)
|
||||
|
||||
dag = filter_dag(dag, re.compile(args.regex), re.compile(args.include_stage))
|
||||
dag = filter_dag(dag, re.compile(args.regex), re.compile(args.include_stage), re.compile(args.exclude_stage))
|
||||
|
||||
print_dag(dag)
|
||||
|
||||
|
Reference in New Issue
Block a user