diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4f49096b8..80c53045c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -31,4 +31,5 @@ jobs: run: | cd test sh build_test_docker.sh + echo "Running tests" python run_tests.py diff --git a/src/sos/__main__.py b/src/sos/__main__.py index e67483b92..3e495112a 100755 --- a/src/sos/__main__.py +++ b/src/sos/__main__.py @@ -1365,7 +1365,7 @@ def get_execute_parser(desc_only=False): ], default="default", metavar="SIGMODE", - dest="sig_mode", + dest="__sig_mode__", help="""How runtime signature would be handled, which can be "default" (save and use signature, default mode in batch mode), "force" (ignore existing signature and overwrite them while @@ -1460,8 +1460,8 @@ def cmd_execute(args, workflow_args): "config_file": args.config, "sig_mode": - "default" if args.sig_mode in (None, - "ignore") else args.sig_mode, + "default" if args.__sig_mode__ in (None, + "ignore") else args.__sig_mode__, "run_mode": "dryrun" if args.dryrun else (args.run_mode if args.run_mode else "run"), diff --git a/src/sos/monitor.py b/src/sos/monitor.py index e80899e3d..f42bcf321 100644 --- a/src/sos/monitor.py +++ b/src/sos/monitor.py @@ -310,12 +310,10 @@ def summarizeExecution(task_id, pulses, status="Unknown"): accu_cpu += float(c) + float(cc) accu_mem += float(m) + float(cm) count += 1 - if float(c) + float(cc) > peak_cpu: - peak_cpu = float(c) + float(cc) - if float(m) + float(cm) > peak_mem: - peak_mem = float(m) + float(cm) - if int(nch) > peak_nch: - peak_nch = int(nch) + + peak_cpu = max(peak_cpu, float(c) + float(cc)) + peak_mem = max(float(m) + float(cm), peak_mem) + peak_nch = max(int(nch), peak_nch) try: second_elapsed = end_time - start_time except Exception: diff --git a/src/sos/targets.py b/src/sos/targets.py index b587b6993..c5e010049 100644 --- a/src/sos/targets.py +++ b/src/sos/targets.py @@ -528,8 +528,13 @@ class file_target(path, BaseTarget): """A regular target for files.""" def __init__(self, *args, **kwargs): - # this is path segments - super().__init__(*args, **kwargs) + if sys.version_info[0] >= 3 and sys.version_info[1] >= 12: + # python 3.12 and above + path.__init__(self, *args, **kwargs) + else: + # python 2.10 and 3.11 + path.__init__(self) + BaseTarget.__init__(self, *args, **kwargs) if len(args) == 1 and isinstance(args[0], file_target): self._md5 = args[0]._md5 if hasattr(args[0], '_md5') else None else: @@ -675,7 +680,7 @@ def __new__(cls, path=None, name=None, suffix=None, prefix=None, dir=None): if cls is Path: cls = WindowsPath if os.name == "nt" else PosixPath filename = request_answer_from_controller(["sos_tempfile", path, name, suffix, prefix, dir]) - return cls._from_parts([filename]) + return file_target(filename) class paths(Sequence, os.PathLike): diff --git a/test/build_test_docker.sh b/test/build_test_docker.sh index 9282a140f..2da3dc725 100644 --- a/test/build_test_docker.sh +++ b/test/build_test_docker.sh @@ -21,10 +21,12 @@ docker rmi eg_sshd # copy the public key here cp ~/.ssh/id_rsa.pub authorized_keys +python_version=$(python --version | cut -d. -f2) # create a docker file # -cat > Dockerfile << 'HERE' -FROM python:3.10 +echo "FROM python:3.${python_version}" > Dockerfile + +cat >> Dockerfile << 'HERE' RUN apt-get update && apt-get install -y openssh-server rsync task-spooler RUN mkdir /var/run/sshd @@ -41,8 +43,8 @@ RUN [ -d /root/.ssh ] || mkdir -p /root/.ssh ADD authorized_keys /root/.ssh/authorized_keys ARG SHA=LATEST -RUN SHA=$SHA git clone http://github.com/vatlab/sos sos -RUN pip install sos sos-pbs +RUN pip install git+https://github.com/vatlab/sos +RUN pip install sos-pbs RUN echo "export TS_SLOTS=10" >> /root/.bash_profile