2022-06-06 18:25:48 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Copyright © 2020 - 2022 Collabora Ltd.
|
|
|
|
# Authors:
|
|
|
|
# Tomeu Vizoso <tomeu.vizoso@collabora.com>
|
|
|
|
# David Heidelberg <david.heidelberg@collabora.com>
|
|
|
|
#
|
2023-03-22 19:23:47 +01:00
|
|
|
# For the dependencies, see the requirements.txt
|
2022-06-06 18:25:48 +02:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
"""
|
|
|
|
Helper script to restrict running only required CI jobs
|
|
|
|
and show the job(s) logs.
|
|
|
|
"""
|
|
|
|
|
2022-07-15 18:15:52 -03:00
|
|
|
import argparse
|
2022-06-06 18:25:48 +02:00
|
|
|
import re
|
|
|
|
import sys
|
2022-07-15 18:15:52 -03:00
|
|
|
import time
|
2023-09-29 10:17:29 -03:00
|
|
|
from collections import defaultdict
|
2022-07-15 18:15:52 -03:00
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
from functools import partial
|
2022-07-15 18:17:02 -03:00
|
|
|
from itertools import chain
|
2024-02-12 14:43:27 +00:00
|
|
|
from subprocess import check_output, CalledProcessError
|
2024-05-23 14:03:50 +02:00
|
|
|
from typing import Dict, TYPE_CHECKING, Iterable, Literal, Optional, Tuple
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2022-07-15 18:15:52 -03:00
|
|
|
import gitlab
|
2024-02-05 22:59:51 +00:00
|
|
|
import gitlab.v4.objects
|
2022-06-06 18:25:48 +02:00
|
|
|
from colorama import Fore, Style
|
2023-10-03 11:28:26 -03:00
|
|
|
from gitlab_common import (
|
2024-01-22 20:16:43 -03:00
|
|
|
GITLAB_URL,
|
|
|
|
TOKEN_DIR,
|
2023-10-18 17:09:48 -03:00
|
|
|
get_gitlab_pipeline_from_url,
|
2024-01-22 20:16:43 -03:00
|
|
|
get_gitlab_project,
|
|
|
|
get_token_from_default_dir,
|
|
|
|
pretty_duration,
|
2024-07-26 12:48:32 -03:00
|
|
|
print_once,
|
2023-10-03 11:28:26 -03:00
|
|
|
read_token,
|
|
|
|
wait_for_pipeline,
|
|
|
|
)
|
2022-08-02 19:01:32 -03:00
|
|
|
from gitlab_gql import GitlabGQL, create_job_needs_dag, filter_dag, print_dag
|
2022-06-06 18:25:48 +02:00
|
|
|
|
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.
This is what looks like:
```
Running 10 dependency jobs:
alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
debian-testing, debian/arm64_build, debian/x86_64_build,
debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
rustfmt
Running 15 target jobs:
a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-01 01:36:07 -03:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
from gitlab_gql import Dag
|
|
|
|
|
2022-06-06 18:25:48 +02:00
|
|
|
REFRESH_WAIT_LOG = 10
|
|
|
|
REFRESH_WAIT_JOBS = 6
|
|
|
|
|
|
|
|
URL_START = "\033]8;;"
|
|
|
|
URL_END = "\033]8;;\a"
|
|
|
|
|
|
|
|
STATUS_COLORS = {
|
|
|
|
"created": "",
|
|
|
|
"running": Fore.BLUE,
|
|
|
|
"success": Fore.GREEN,
|
|
|
|
"failed": Fore.RED,
|
|
|
|
"canceled": Fore.MAGENTA,
|
2024-06-26 17:21:22 +02:00
|
|
|
"canceling": Fore.MAGENTA,
|
2022-06-06 18:25:48 +02:00
|
|
|
"manual": "",
|
|
|
|
"pending": "",
|
|
|
|
"skipped": "",
|
|
|
|
}
|
|
|
|
|
2024-08-05 19:04:10 -03:00
|
|
|
COMPLETED_STATUSES = frozenset({"success", "failed"})
|
|
|
|
RUNNING_STATUSES = frozenset({"created", "pending", "running"})
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def print_job_status(
|
|
|
|
job: gitlab.v4.objects.ProjectPipelineJob,
|
|
|
|
new_status: bool = False,
|
2024-05-24 09:17:14 +02:00
|
|
|
job_name_field_pad: int = 0,
|
2024-05-24 09:10:22 +02:00
|
|
|
) -> None:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""It prints a nice, colored job status with a link to the job."""
|
2024-06-26 17:21:22 +02:00
|
|
|
if job.status in {"canceled", "canceling"}:
|
2022-06-06 18:25:48 +02:00
|
|
|
return
|
|
|
|
|
2024-02-01 18:45:59 +00:00
|
|
|
if new_status and job.status == "created":
|
|
|
|
return
|
|
|
|
|
2024-05-24 09:17:14 +02:00
|
|
|
job_name_field_pad = len(job.name) if job_name_field_pad < 1 else job_name_field_pad
|
|
|
|
|
2024-05-23 14:03:50 +02:00
|
|
|
duration = job_duration(job)
|
2023-10-03 11:28:26 -03:00
|
|
|
|
2024-07-26 12:48:32 -03:00
|
|
|
print_once(
|
2022-06-06 18:25:48 +02:00
|
|
|
STATUS_COLORS[job.status]
|
2024-07-26 12:48:32 -03:00
|
|
|
+ "🞋 job " # U+1F78B Round target
|
2024-05-24 09:17:14 +02:00
|
|
|
+ link2print(job.web_url, job.name, job_name_field_pad)
|
|
|
|
+ (f"has new status: {job.status}" if new_status else f"{job.status}")
|
2023-10-03 11:28:26 -03:00
|
|
|
+ (f" ({pretty_duration(duration)})" if job.started_at else "")
|
2022-06-06 18:25:48 +02:00
|
|
|
+ Style.RESET_ALL
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-05-23 14:03:50 +02:00
|
|
|
def job_duration(job: gitlab.v4.objects.ProjectPipelineJob) -> float:
|
|
|
|
"""
|
|
|
|
Given a job, report the time lapsed in execution.
|
|
|
|
:param job: Pipeline job
|
|
|
|
:return: Current time in execution
|
|
|
|
"""
|
|
|
|
if job.duration:
|
|
|
|
return job.duration
|
|
|
|
elif job.started_at:
|
|
|
|
return time.perf_counter() - time.mktime(job.started_at.timetuple())
|
|
|
|
return 0.0
|
|
|
|
|
|
|
|
|
2022-06-06 18:25:48 +02:00
|
|
|
def pretty_wait(sec: int) -> None:
|
|
|
|
"""shows progressbar in dots"""
|
|
|
|
for val in range(sec, 0, -1):
|
2024-05-24 09:10:22 +02:00
|
|
|
print(f"⏲ {val} seconds", end="\r") # U+23F2 Timer clock
|
2022-06-06 18:25:48 +02:00
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
def monitor_pipeline(
|
2024-05-24 09:10:22 +02:00
|
|
|
project: gitlab.v4.objects.Project,
|
|
|
|
pipeline: gitlab.v4.objects.ProjectPipeline,
|
2023-11-04 14:52:41 +00:00
|
|
|
target_jobs_regex: re.Pattern,
|
2024-08-22 12:37:58 +01:00
|
|
|
include_stage_regex: re.Pattern,
|
2024-05-24 09:10:22 +02:00
|
|
|
dependencies: set[str],
|
2022-08-11 15:59:05 +02:00
|
|
|
force_manual: bool,
|
2023-09-29 23:31:30 -03:00
|
|
|
stress: int,
|
2024-05-23 14:03:50 +02:00
|
|
|
) -> tuple[Optional[int], Optional[int], Dict[str, Dict[int, Tuple[float, str, str]]]]:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""Monitors pipeline and delegate canceling jobs"""
|
2023-09-29 20:47:00 -03:00
|
|
|
statuses: dict[str, str] = defaultdict(str)
|
|
|
|
target_statuses: dict[str, str] = defaultdict(str)
|
2024-05-24 09:10:22 +02:00
|
|
|
stress_status_counter: dict[str, dict[str, int]] = defaultdict(lambda: defaultdict(int))
|
2024-05-23 14:03:50 +02:00
|
|
|
execution_times = defaultdict(lambda: defaultdict(tuple))
|
2024-05-24 09:10:22 +02:00
|
|
|
target_id: int = -1
|
2024-05-24 09:17:14 +02:00
|
|
|
name_field_pad: int = len(max(dependencies, key=len))+2
|
2024-07-26 12:17:29 -03:00
|
|
|
# In a running pipeline, we can skip following job traces that are in these statuses.
|
2024-08-05 19:04:10 -03:00
|
|
|
skip_follow_statuses: frozenset[str] = (
|
|
|
|
COMPLETED_STATUSES
|
|
|
|
if force_manual
|
2024-07-26 12:17:29 -03:00
|
|
|
# If the target job is marked as manual and we don't force it to run, it will be skipped.
|
2024-08-05 19:04:10 -03:00
|
|
|
else frozenset({*COMPLETED_STATUSES, "manual"})
|
|
|
|
)
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2024-05-28 14:48:05 +02:00
|
|
|
# Pre-populate the stress status counter for already completed target jobs.
|
|
|
|
if stress:
|
|
|
|
# When stress test, it is necessary to collect this information before start.
|
|
|
|
for job in pipeline.jobs.list(all=True, include_retried=True):
|
2024-08-22 12:37:58 +01:00
|
|
|
if target_jobs_regex.fullmatch(job.name) and \
|
|
|
|
include_stage_regex.fullmatch(job.stage) and \
|
|
|
|
job.status in COMPLETED_STATUSES:
|
2024-05-28 14:48:05 +02:00
|
|
|
stress_status_counter[job.name][job.status] += 1
|
2024-05-23 14:03:50 +02:00
|
|
|
execution_times[job.name][job.id] = (job_duration(job), job.status, job.web_url)
|
2024-05-28 14:48:05 +02:00
|
|
|
|
2024-07-25 00:34:31 -03:00
|
|
|
# jobs_waiting is a list of job names that are waiting for status update.
|
|
|
|
# It occurs when a job that we want to run depends on another job that is not yet finished.
|
|
|
|
jobs_waiting = []
|
|
|
|
# FIXME: This function has too many parameters, consider refactoring.
|
|
|
|
enable_job_fn = partial(
|
|
|
|
enable_job,
|
|
|
|
project=project,
|
|
|
|
pipeline=pipeline,
|
|
|
|
force_manual=force_manual,
|
|
|
|
job_name_field_pad=name_field_pad,
|
|
|
|
jobs_waiting=jobs_waiting,
|
|
|
|
)
|
2022-06-06 18:25:48 +02:00
|
|
|
while True:
|
2023-11-10 18:41:42 -03:00
|
|
|
deps_failed = []
|
2022-06-06 18:25:48 +02:00
|
|
|
to_cancel = []
|
2024-07-25 00:34:31 -03:00
|
|
|
jobs_waiting.clear()
|
2024-06-13 14:32:23 +02:00
|
|
|
for job in sorted(pipeline.jobs.list(all=True), key=lambda j: j.name):
|
2024-08-22 12:37:58 +01:00
|
|
|
if target_jobs_regex.fullmatch(job.name) and \
|
|
|
|
include_stage_regex.fullmatch(job.stage):
|
2023-09-29 20:47:00 -03:00
|
|
|
target_id = job.id
|
2024-05-23 14:03:50 +02:00
|
|
|
target_status = job.status
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2024-06-26 17:46:09 +02:00
|
|
|
if stress and target_status in COMPLETED_STATUSES:
|
2023-09-29 23:31:30 -03:00
|
|
|
if (
|
|
|
|
stress < 0
|
|
|
|
or sum(stress_status_counter[job.name].values()) < stress
|
|
|
|
):
|
2024-05-23 14:03:50 +02:00
|
|
|
stress_status_counter[job.name][target_status] += 1
|
|
|
|
execution_times[job.name][job.id] = (job_duration(job), target_status, job.web_url)
|
2024-07-25 00:34:31 -03:00
|
|
|
job = enable_job_fn(job=job, action_type="retry")
|
2023-09-29 20:47:00 -03:00
|
|
|
else:
|
2024-05-23 14:03:50 +02:00
|
|
|
execution_times[job.name][job.id] = (job_duration(job), target_status, job.web_url)
|
2024-07-25 00:34:31 -03:00
|
|
|
job = enable_job_fn(job=job, action_type="target")
|
2022-08-11 15:59:05 +02:00
|
|
|
|
2024-05-24 09:17:14 +02:00
|
|
|
print_job_status(job, target_status not in target_statuses[job.name], name_field_pad)
|
2024-05-23 14:03:50 +02:00
|
|
|
target_statuses[job.name] = target_status
|
2022-06-06 18:25:48 +02:00
|
|
|
continue
|
|
|
|
|
2024-05-27 13:47:52 +02:00
|
|
|
# all other non-target jobs
|
2023-09-29 20:47:00 -03:00
|
|
|
if job.status != statuses[job.name]:
|
2024-05-24 09:17:14 +02:00
|
|
|
print_job_status(job, True, name_field_pad)
|
2023-09-29 20:47:00 -03:00
|
|
|
statuses[job.name] = job.status
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2023-09-29 20:47:00 -03:00
|
|
|
# run dependencies and cancel the rest
|
2022-06-06 18:25:48 +02:00
|
|
|
if job.name in dependencies:
|
2024-07-25 00:34:31 -03:00
|
|
|
job = enable_job_fn(job=job, action_type="dep")
|
2023-11-10 18:41:42 -03:00
|
|
|
if job.status == "failed":
|
|
|
|
deps_failed.append(job.name)
|
2023-09-29 20:47:00 -03:00
|
|
|
else:
|
2022-06-06 18:25:48 +02:00
|
|
|
to_cancel.append(job)
|
|
|
|
|
2023-09-29 18:53:19 -03:00
|
|
|
cancel_jobs(project, to_cancel)
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2022-08-11 15:59:05 +02:00
|
|
|
if stress:
|
2023-09-29 23:31:30 -03:00
|
|
|
enough = True
|
2024-06-13 14:32:23 +02:00
|
|
|
for job_name, status in sorted(stress_status_counter.items()):
|
2023-09-29 10:17:29 -03:00
|
|
|
print(
|
2024-05-24 09:17:14 +02:00
|
|
|
f"* {job_name:{name_field_pad}}succ: {status['success']}; "
|
2023-09-29 10:17:29 -03:00
|
|
|
f"fail: {status['failed']}; "
|
2023-09-29 23:31:30 -03:00
|
|
|
f"total: {sum(status.values())} of {stress}",
|
2023-09-29 10:17:29 -03:00
|
|
|
flush=False,
|
|
|
|
)
|
2023-09-29 23:31:30 -03:00
|
|
|
if stress < 0 or sum(status.values()) < stress:
|
|
|
|
enough = False
|
|
|
|
|
|
|
|
if not enough:
|
|
|
|
pretty_wait(REFRESH_WAIT_JOBS)
|
|
|
|
continue
|
2022-08-11 15:59:05 +02:00
|
|
|
|
2024-07-25 00:34:31 -03:00
|
|
|
if jobs_waiting:
|
2024-07-26 12:48:32 -03:00
|
|
|
print_once(
|
2024-07-25 00:34:31 -03:00
|
|
|
f"{Fore.YELLOW}Waiting for jobs to update status:",
|
|
|
|
", ".join(jobs_waiting),
|
|
|
|
Fore.RESET,
|
|
|
|
)
|
|
|
|
pretty_wait(REFRESH_WAIT_JOBS)
|
|
|
|
continue
|
|
|
|
|
2024-07-17 11:01:45 +02:00
|
|
|
if len(target_statuses) == 1 and RUNNING_STATUSES.intersection(
|
2022-06-06 18:25:48 +02:00
|
|
|
target_statuses.values()
|
|
|
|
):
|
2024-05-23 14:03:50 +02:00
|
|
|
return target_id, None, execution_times
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2023-10-20 08:52:12 -03:00
|
|
|
if (
|
|
|
|
{"failed"}.intersection(target_statuses.values())
|
2024-06-26 18:00:43 +02:00
|
|
|
and not RUNNING_STATUSES.intersection(target_statuses.values())
|
2023-10-20 08:52:12 -03:00
|
|
|
):
|
2024-05-23 14:03:50 +02:00
|
|
|
return None, 1, execution_times
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2023-11-10 18:41:42 -03:00
|
|
|
if (
|
|
|
|
{"skipped"}.intersection(target_statuses.values())
|
2024-06-26 18:00:43 +02:00
|
|
|
and not RUNNING_STATUSES.intersection(target_statuses.values())
|
2023-11-10 18:41:42 -03:00
|
|
|
):
|
|
|
|
print(
|
|
|
|
Fore.RED,
|
|
|
|
"Target in skipped state, aborting. Failed dependencies:",
|
|
|
|
deps_failed,
|
|
|
|
Fore.RESET,
|
|
|
|
)
|
2024-05-23 14:03:50 +02:00
|
|
|
return None, 1, execution_times
|
2023-11-10 18:41:42 -03:00
|
|
|
|
2024-07-26 12:17:29 -03:00
|
|
|
if skip_follow_statuses.issuperset(target_statuses.values()):
|
2024-05-23 14:03:50 +02:00
|
|
|
return None, 0, execution_times
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
pretty_wait(REFRESH_WAIT_JOBS)
|
|
|
|
|
|
|
|
|
2024-02-07 16:43:29 +00:00
|
|
|
def get_pipeline_job(
|
|
|
|
pipeline: gitlab.v4.objects.ProjectPipeline,
|
2024-05-24 09:10:22 +02:00
|
|
|
job_id: int,
|
2024-02-07 16:43:29 +00:00
|
|
|
) -> gitlab.v4.objects.ProjectPipelineJob:
|
|
|
|
pipeline_jobs = pipeline.jobs.list(all=True)
|
2024-05-24 09:10:22 +02:00
|
|
|
return [j for j in pipeline_jobs if j.id == job_id][0]
|
2024-02-07 16:43:29 +00:00
|
|
|
|
|
|
|
|
2023-09-29 20:47:00 -03:00
|
|
|
def enable_job(
|
2024-02-05 22:59:51 +00:00
|
|
|
project: gitlab.v4.objects.Project,
|
2024-02-05 22:59:51 +00:00
|
|
|
pipeline: gitlab.v4.objects.ProjectPipeline,
|
2024-02-05 22:59:51 +00:00
|
|
|
job: gitlab.v4.objects.ProjectPipelineJob,
|
|
|
|
action_type: Literal["target", "dep", "retry"],
|
|
|
|
force_manual: bool,
|
2024-05-24 09:17:14 +02:00
|
|
|
job_name_field_pad: int = 0,
|
2024-07-25 00:34:31 -03:00
|
|
|
jobs_waiting: list[str] = [],
|
2024-02-05 22:59:51 +00:00
|
|
|
) -> gitlab.v4.objects.ProjectPipelineJob:
|
2024-07-25 00:34:31 -03:00
|
|
|
# We want to run this job, but it is not ready to run yet, so let's try again in the next
|
|
|
|
# iteration.
|
|
|
|
if job.status == "created":
|
|
|
|
jobs_waiting.append(job.name)
|
|
|
|
return job
|
|
|
|
|
2023-09-29 20:47:00 -03:00
|
|
|
if (
|
2024-06-26 17:46:09 +02:00
|
|
|
(job.status in COMPLETED_STATUSES and action_type != "retry")
|
2023-09-29 20:47:00 -03:00
|
|
|
or (job.status == "manual" and not force_manual)
|
2024-06-26 18:00:43 +02:00
|
|
|
or job.status in {"skipped"} | RUNNING_STATUSES
|
2023-09-29 20:47:00 -03:00
|
|
|
):
|
2024-02-05 22:59:51 +00:00
|
|
|
return job
|
2023-09-29 20:47:00 -03:00
|
|
|
|
2022-06-06 18:25:48 +02:00
|
|
|
pjob = project.jobs.get(job.id, lazy=True)
|
2023-09-29 20:32:48 -03:00
|
|
|
|
2024-06-26 17:37:02 +02:00
|
|
|
if job.status in {"success", "failed", "canceled", "canceling"}:
|
2024-02-05 22:59:51 +00:00
|
|
|
new_job = pjob.retry()
|
|
|
|
job = get_pipeline_job(pipeline, new_job["id"])
|
2023-09-29 20:32:48 -03:00
|
|
|
else:
|
|
|
|
pjob.play()
|
2024-02-05 23:20:06 +00:00
|
|
|
job = get_pipeline_job(pipeline, pjob.id)
|
2023-09-29 20:32:48 -03:00
|
|
|
|
|
|
|
if action_type == "target":
|
2024-07-17 13:34:29 +02:00
|
|
|
jtype = "🞋 target" # U+1F78B Round target
|
2023-09-29 20:32:48 -03:00
|
|
|
elif action_type == "retry":
|
2024-07-17 13:34:29 +02:00
|
|
|
jtype = "↻ retrying" # U+21BB Clockwise open circle arrow
|
2022-06-06 18:25:48 +02:00
|
|
|
else:
|
2024-07-17 13:34:29 +02:00
|
|
|
jtype = "↪ dependency" # U+21AA Left Arrow Curving Right
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2024-05-24 09:17:14 +02:00
|
|
|
job_name_field_pad = len(job.name) if job_name_field_pad < 1 else job_name_field_pad
|
|
|
|
print(Fore.MAGENTA + f"{jtype} job {job.name:{job_name_field_pad}}manually enabled" + Style.RESET_ALL)
|
2022-08-11 15:59:05 +02:00
|
|
|
|
2024-02-05 22:59:51 +00:00
|
|
|
return job
|
|
|
|
|
2022-08-11 15:59:05 +02:00
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def cancel_job(
|
|
|
|
project: gitlab.v4.objects.Project,
|
|
|
|
job: gitlab.v4.objects.ProjectPipelineJob
|
|
|
|
) -> None:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""Cancel GitLab job"""
|
2024-06-26 18:00:43 +02:00
|
|
|
if job.status not in RUNNING_STATUSES:
|
2023-09-29 20:47:00 -03:00
|
|
|
return
|
2022-06-06 18:25:48 +02:00
|
|
|
pjob = project.jobs.get(job.id, lazy=True)
|
|
|
|
pjob.cancel()
|
2024-07-18 11:41:34 +02:00
|
|
|
print(f"🗙 {job.name}", end=" ") # U+1F5D9 Cancellation X
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def cancel_jobs(
|
|
|
|
project: gitlab.v4.objects.Project,
|
|
|
|
to_cancel: list
|
|
|
|
) -> None:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""Cancel unwanted GitLab jobs"""
|
|
|
|
if not to_cancel:
|
|
|
|
return
|
|
|
|
|
|
|
|
with ThreadPoolExecutor(max_workers=6) as exe:
|
|
|
|
part = partial(cancel_job, project)
|
|
|
|
exe.map(part, to_cancel)
|
2024-07-26 12:48:32 -03:00
|
|
|
|
|
|
|
# The cancelled jobs are printed without a newline
|
|
|
|
print_once()
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def print_log(
|
|
|
|
project: gitlab.v4.objects.Project,
|
|
|
|
job_id: int
|
|
|
|
) -> None:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""Print job log into output"""
|
|
|
|
printed_lines = 0
|
|
|
|
while True:
|
|
|
|
job = project.jobs.get(job_id)
|
|
|
|
|
|
|
|
# GitLab's REST API doesn't offer pagination for logs, so we have to refetch it all
|
2024-02-16 12:00:56 +00:00
|
|
|
lines = job.trace().decode().splitlines()
|
2022-06-06 18:25:48 +02:00
|
|
|
for line in lines[printed_lines:]:
|
|
|
|
print(line)
|
|
|
|
printed_lines = len(lines)
|
|
|
|
|
|
|
|
if job.status in COMPLETED_STATUSES:
|
|
|
|
print(Fore.GREEN + f"Job finished: {job.web_url}" + Style.RESET_ALL)
|
|
|
|
return
|
|
|
|
pretty_wait(REFRESH_WAIT_LOG)
|
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def parse_args() -> argparse.Namespace:
|
2022-06-06 18:25:48 +02:00
|
|
|
"""Parse args"""
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description="Tool to trigger a subset of container jobs "
|
|
|
|
+ "and monitor the progress of a test job",
|
|
|
|
epilog="Example: mesa-monitor.py --rev $(git rev-parse HEAD) "
|
|
|
|
+ '--target ".*traces" ',
|
|
|
|
)
|
2023-09-29 09:40:32 -03:00
|
|
|
parser.add_argument(
|
|
|
|
"--target",
|
|
|
|
metavar="target-job",
|
2024-03-29 13:02:13 +00:00
|
|
|
help="Target job regex. For multiple targets, pass multiple values, "
|
2024-08-22 12:37:58 +01:00
|
|
|
"eg. `--target foo bar`. Only jobs in the target stage(s) "
|
|
|
|
"supplied, and their dependencies, will be considered.",
|
2023-09-29 18:53:19 -03:00
|
|
|
required=True,
|
2024-01-24 23:21:29 +00:00
|
|
|
nargs=argparse.ONE_OR_MORE,
|
2023-09-29 09:40:32 -03:00
|
|
|
)
|
2024-08-22 12:37:58 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"--include-stage",
|
|
|
|
metavar="include-stage",
|
|
|
|
help="Job stages to include when searching for target jobs. "
|
|
|
|
"For multiple targets, pass multiple values, eg. "
|
|
|
|
"`--include-stage foo bar`.",
|
|
|
|
default=[".*"],
|
|
|
|
nargs=argparse.ONE_OR_MORE,
|
|
|
|
)
|
2022-06-06 18:25:48 +02:00
|
|
|
parser.add_argument(
|
|
|
|
"--token",
|
|
|
|
metavar="token",
|
2024-01-22 20:16:43 -03:00
|
|
|
type=str,
|
|
|
|
default=get_token_from_default_dir(),
|
|
|
|
help="Use the provided GitLab token or token file, "
|
|
|
|
f"otherwise it's read from {TOKEN_DIR / 'gitlab-token'}",
|
2022-06-06 18:25:48 +02:00
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--force-manual", action="store_true", help="Force jobs marked as manual"
|
|
|
|
)
|
2023-09-29 23:31:30 -03:00
|
|
|
parser.add_argument(
|
|
|
|
"--stress",
|
|
|
|
default=0,
|
|
|
|
type=int,
|
2024-05-28 14:48:05 +02:00
|
|
|
help="Stresstest job(s). Specify the number of times to rerun the selected jobs, "
|
|
|
|
"or use -1 for indefinite. Defaults to 0. If jobs have already been executed, "
|
|
|
|
"this will ensure the total run count respects the specified number.",
|
2023-09-29 23:31:30 -03:00
|
|
|
)
|
2023-09-29 22:41:58 -03:00
|
|
|
parser.add_argument(
|
|
|
|
"--project",
|
|
|
|
default="mesa",
|
|
|
|
help="GitLab project in the format <user>/<project> or just <project>",
|
|
|
|
)
|
2023-07-28 13:09:24 +01:00
|
|
|
|
|
|
|
mutex_group1 = parser.add_mutually_exclusive_group()
|
|
|
|
mutex_group1.add_argument(
|
2023-10-20 12:11:13 +02:00
|
|
|
"--rev", default="HEAD", metavar="revision", help="repository git revision (default: HEAD)"
|
2023-07-28 13:09:24 +01:00
|
|
|
)
|
|
|
|
mutex_group1.add_argument(
|
|
|
|
"--pipeline-url",
|
|
|
|
help="URL of the pipeline to use, instead of auto-detecting it.",
|
|
|
|
)
|
2023-11-27 17:47:58 +00:00
|
|
|
mutex_group1.add_argument(
|
|
|
|
"--mr",
|
|
|
|
type=int,
|
|
|
|
help="ID of a merge request; the latest pipeline in that MR will be used.",
|
|
|
|
)
|
2023-07-28 13:09:24 +01:00
|
|
|
|
2023-08-29 18:15:47 +01:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
# argparse doesn't support groups inside add_mutually_exclusive_group(),
|
|
|
|
# which means we can't just put `--project` and `--rev` in a group together,
|
|
|
|
# we have to do this by heand instead.
|
|
|
|
if args.pipeline_url and args.project != parser.get_default("project"):
|
|
|
|
# weird phrasing but it's the error add_mutually_exclusive_group() gives
|
|
|
|
parser.error("argument --project: not allowed with argument --pipeline-url")
|
|
|
|
|
|
|
|
return args
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
|
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.
This is what looks like:
```
Running 10 dependency jobs:
alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
debian-testing, debian/arm64_build, debian/x86_64_build,
debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
rustfmt
Running 15 target jobs:
a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-01 01:36:07 -03:00
|
|
|
def print_detected_jobs(
|
2024-05-24 09:10:22 +02:00
|
|
|
target_dep_dag: "Dag",
|
|
|
|
dependency_jobs: Iterable[str],
|
|
|
|
target_jobs: Iterable[str],
|
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.
This is what looks like:
```
Running 10 dependency jobs:
alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
debian-testing, debian/arm64_build, debian/x86_64_build,
debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
rustfmt
Running 15 target jobs:
a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-01 01:36:07 -03:00
|
|
|
) -> None:
|
|
|
|
def print_job_set(color: str, kind: str, job_set: Iterable[str]):
|
|
|
|
print(
|
|
|
|
color + f"Running {len(job_set)} {kind} jobs: ",
|
2024-05-24 09:17:14 +02:00
|
|
|
"\n\t",
|
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.
This is what looks like:
```
Running 10 dependency jobs:
alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
debian-testing, debian/arm64_build, debian/x86_64_build,
debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
rustfmt
Running 15 target jobs:
a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-01 01:36:07 -03:00
|
|
|
", ".join(sorted(job_set)),
|
|
|
|
Fore.RESET,
|
|
|
|
"\n",
|
|
|
|
)
|
|
|
|
|
|
|
|
print(Fore.YELLOW + "Detected target job and its dependencies:", "\n")
|
|
|
|
print_dag(target_dep_dag)
|
|
|
|
print_job_set(Fore.MAGENTA, "dependency", dependency_jobs)
|
|
|
|
print_job_set(Fore.BLUE, "target", target_jobs)
|
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def find_dependencies(
|
|
|
|
token: str | None,
|
|
|
|
target_jobs_regex: re.Pattern,
|
2024-08-22 12:37:58 +01:00
|
|
|
include_stage_regex: re.Pattern,
|
2024-05-24 09:10:22 +02:00
|
|
|
project_path: str,
|
|
|
|
iid: int
|
|
|
|
) -> set[str]:
|
2024-01-22 20:13:54 -03:00
|
|
|
"""
|
|
|
|
Find the dependencies of the target jobs in a GitLab pipeline.
|
|
|
|
|
|
|
|
This function uses the GitLab GraphQL API to fetch the job dependency graph
|
|
|
|
of a pipeline, filters the graph to only include the target jobs and their
|
|
|
|
dependencies, and returns the names of these jobs.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
token (str | None): The GitLab API token. If None, the API is accessed without
|
|
|
|
authentication.
|
|
|
|
target_jobs_regex (re.Pattern): A regex pattern to match the names of the target jobs.
|
|
|
|
project_path (str): The path of the GitLab project.
|
|
|
|
iid (int): The internal ID of the pipeline.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
set[str]: A set of the names of the target jobs and their dependencies.
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
SystemExit: If no target jobs are found in the pipeline.
|
|
|
|
"""
|
|
|
|
gql_instance = GitlabGQL(token=token)
|
2023-10-28 00:45:03 -03:00
|
|
|
dag = create_job_needs_dag(
|
2023-10-24 00:08:37 -03:00
|
|
|
gql_instance, {"projectPath": project_path.path_with_namespace, "iid": iid}
|
2022-07-15 18:17:02 -03:00
|
|
|
)
|
2022-08-02 19:01:32 -03:00
|
|
|
|
2024-08-22 12:37:58 +01:00
|
|
|
target_dep_dag = filter_dag(dag, target_jobs_regex, include_stage_regex)
|
2022-11-19 21:30:39 +01:00
|
|
|
if not target_dep_dag:
|
|
|
|
print(Fore.RED + "The job(s) were not found in the pipeline." + Fore.RESET)
|
|
|
|
sys.exit(1)
|
2023-10-28 00:45:03 -03:00
|
|
|
|
|
|
|
dependency_jobs = set(chain.from_iterable(d["needs"] for d in target_dep_dag.values()))
|
|
|
|
target_jobs = set(target_dep_dag.keys())
|
ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.
This is what looks like:
```
Running 10 dependency jobs:
alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
debian-testing, debian/arm64_build, debian/x86_64_build,
debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
rustfmt
Running 15 target jobs:
a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-01 01:36:07 -03:00
|
|
|
print_detected_jobs(target_dep_dag, dependency_jobs, target_jobs)
|
2023-10-28 00:45:03 -03:00
|
|
|
return target_jobs.union(dependency_jobs)
|
2022-07-15 18:17:02 -03:00
|
|
|
|
|
|
|
|
2024-05-23 14:03:50 +02:00
|
|
|
def print_monitor_summary(
|
|
|
|
execution_collection: Dict[str, Dict[int, Tuple[float, str, str]]],
|
|
|
|
t_start: float,
|
|
|
|
) -> None:
|
|
|
|
"""Summary of the test execution"""
|
|
|
|
t_end = time.perf_counter()
|
|
|
|
spend_minutes = (t_end - t_start) / 60
|
2024-05-24 09:10:22 +02:00
|
|
|
print(f"⏲ Duration of script execution: {spend_minutes:0.1f} minutes") # U+23F2 Timer clock
|
2024-05-23 14:03:50 +02:00
|
|
|
if len(execution_collection) == 0:
|
|
|
|
return
|
2024-05-24 09:10:22 +02:00
|
|
|
print(f"⏲ Jobs execution times:") # U+23F2 Timer clock
|
2024-05-23 14:03:50 +02:00
|
|
|
job_names = list(execution_collection.keys())
|
|
|
|
job_names.sort()
|
|
|
|
name_field_pad = len(max(job_names, key=len)) + 2
|
|
|
|
for name in job_names:
|
|
|
|
job_executions = execution_collection[name]
|
|
|
|
job_times = ', '.join([__job_duration_record(job_execution)
|
|
|
|
for job_execution in sorted(job_executions.items())])
|
|
|
|
print(f"* {name:{name_field_pad}}: ({len(job_executions)}) {job_times}")
|
|
|
|
|
|
|
|
|
|
|
|
def __job_duration_record(dict_item: tuple) -> str:
|
|
|
|
"""
|
|
|
|
Format each pair of job and its duration.
|
|
|
|
:param job_execution: item of execution_collection[name][idn]: Dict[int, Tuple[float, str, str]]
|
|
|
|
"""
|
2024-05-24 09:17:14 +02:00
|
|
|
job_id = f"{dict_item[0]}" # dictionary key
|
2024-05-23 14:03:50 +02:00
|
|
|
job_duration, job_status, job_url = dict_item[1] # dictionary value, the tuple
|
|
|
|
return (f"{STATUS_COLORS[job_status]}"
|
|
|
|
f"{link2print(job_url, job_id)}: {pretty_duration(job_duration):>8}"
|
|
|
|
f"{Style.RESET_ALL}")
|
|
|
|
|
|
|
|
|
2024-05-24 09:17:14 +02:00
|
|
|
def link2print(url: str, text: str, text_pad: int = 0) -> str:
|
|
|
|
text_pad = len(text) if text_pad < 1 else text_pad
|
|
|
|
return f"{URL_START}{url}\a{text:{text_pad}}{URL_END}"
|
2024-05-23 14:03:50 +02:00
|
|
|
|
|
|
|
|
2024-05-24 09:10:22 +02:00
|
|
|
def main() -> None:
|
2022-06-06 18:25:48 +02:00
|
|
|
try:
|
|
|
|
t_start = time.perf_counter()
|
|
|
|
|
|
|
|
args = parse_args()
|
|
|
|
|
|
|
|
token = read_token(args.token)
|
|
|
|
|
2023-05-24 22:58:28 +01:00
|
|
|
gl = gitlab.Gitlab(url=GITLAB_URL,
|
2022-12-01 10:49:56 +00:00
|
|
|
private_token=token,
|
|
|
|
retry_transient_errors=True)
|
2022-06-06 18:25:48 +02:00
|
|
|
|
2022-12-16 00:36:13 +01:00
|
|
|
REV: str = args.rev
|
2023-05-24 22:58:28 +01:00
|
|
|
|
|
|
|
if args.pipeline_url:
|
2023-10-18 17:09:48 -03:00
|
|
|
pipe, cur_project = get_gitlab_pipeline_from_url(gl, args.pipeline_url)
|
2023-07-28 13:09:24 +01:00
|
|
|
REV = pipe.sha
|
2023-05-24 22:58:28 +01:00
|
|
|
else:
|
2023-10-19 12:03:34 +02:00
|
|
|
mesa_project = gl.projects.get("mesa/mesa")
|
2023-11-27 17:47:58 +00:00
|
|
|
projects = [mesa_project]
|
|
|
|
if args.mr:
|
|
|
|
REV = mesa_project.mergerequests.get(args.mr).sha
|
|
|
|
else:
|
|
|
|
REV = check_output(['git', 'rev-parse', REV]).decode('ascii').strip()
|
2024-01-10 11:49:19 +00:00
|
|
|
|
|
|
|
if args.rev == 'HEAD':
|
2024-02-12 14:43:27 +00:00
|
|
|
try:
|
|
|
|
branch_name = check_output([
|
|
|
|
'git', 'symbolic-ref', '-q', 'HEAD',
|
|
|
|
]).decode('ascii').strip()
|
|
|
|
except CalledProcessError:
|
|
|
|
branch_name = ""
|
|
|
|
|
|
|
|
# Ignore detached heads
|
|
|
|
if branch_name:
|
|
|
|
tracked_remote = check_output([
|
|
|
|
'git', 'for-each-ref', '--format=%(upstream)',
|
|
|
|
branch_name,
|
2024-02-12 10:51:47 +01:00
|
|
|
]).decode('ascii').strip()
|
|
|
|
|
2024-02-12 14:43:27 +00:00
|
|
|
# Ignore local branches that do not track any remote
|
|
|
|
if tracked_remote:
|
|
|
|
remote_rev = check_output([
|
|
|
|
'git', 'rev-parse', tracked_remote,
|
|
|
|
]).decode('ascii').strip()
|
|
|
|
|
|
|
|
if REV != remote_rev:
|
|
|
|
print(
|
|
|
|
f"Local HEAD commit {REV[:10]} is different than "
|
|
|
|
f"tracked remote HEAD commit {remote_rev[:10]}"
|
|
|
|
)
|
|
|
|
print("Did you forget to `git push` ?")
|
2024-01-10 11:49:19 +00:00
|
|
|
|
2023-11-27 17:47:58 +00:00
|
|
|
projects.append(get_gitlab_project(gl, args.project))
|
|
|
|
(pipe, cur_project) = wait_for_pipeline(projects, REV)
|
2023-07-28 13:09:24 +01:00
|
|
|
|
|
|
|
print(f"Revision: {REV}")
|
2022-06-06 18:25:48 +02:00
|
|
|
print(f"Pipeline: {pipe.web_url}")
|
2023-05-24 22:58:28 +01:00
|
|
|
|
2024-01-24 23:21:29 +00:00
|
|
|
target = '|'.join(args.target)
|
2024-02-08 17:56:20 +00:00
|
|
|
target = target.strip()
|
|
|
|
|
2024-07-17 13:34:29 +02:00
|
|
|
print("🞋 target job: " + Fore.BLUE + target + Style.RESET_ALL) # U+1F78B Round target
|
2024-02-08 18:02:31 +00:00
|
|
|
|
2024-02-08 17:56:20 +00:00
|
|
|
# Implicitly include `parallel:` jobs
|
|
|
|
target = f'({target})' + r'( \d+/\d+)?'
|
|
|
|
|
|
|
|
target_jobs_regex = re.compile(target)
|
2023-11-04 14:52:41 +00:00
|
|
|
|
2024-08-22 12:37:58 +01:00
|
|
|
include_stage = '|'.join(args.include_stage)
|
|
|
|
include_stage = include_stage.strip()
|
|
|
|
|
|
|
|
print("🞋 target from stages: " + Fore.BLUE + include_stage + Style.RESET_ALL) # U+1F78B Round target
|
|
|
|
|
|
|
|
include_stage_regex = re.compile(include_stage)
|
|
|
|
|
2024-01-24 23:19:33 +00:00
|
|
|
deps = find_dependencies(
|
2024-01-22 20:13:54 -03:00
|
|
|
token=token,
|
|
|
|
target_jobs_regex=target_jobs_regex,
|
2024-08-22 12:37:58 +01:00
|
|
|
include_stage_regex=include_stage_regex,
|
2024-01-22 20:13:54 -03:00
|
|
|
iid=pipe.iid,
|
|
|
|
project_path=cur_project
|
2024-01-24 23:19:33 +00:00
|
|
|
)
|
2024-05-23 14:03:50 +02:00
|
|
|
target_job_id, ret, exec_t = monitor_pipeline(
|
2024-08-22 12:37:58 +01:00
|
|
|
cur_project, pipe, target_jobs_regex, include_stage_regex, deps, args.force_manual, args.stress
|
2022-06-06 18:25:48 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if target_job_id:
|
|
|
|
print_log(cur_project, target_job_id)
|
|
|
|
|
2024-05-23 14:03:50 +02:00
|
|
|
print_monitor_summary(exec_t, t_start)
|
2022-06-06 18:25:48 +02:00
|
|
|
|
|
|
|
sys.exit(ret)
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
sys.exit(1)
|
2024-05-24 09:10:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|