diff --git a/.github/workflows/cgatcore_python.yml b/.github/workflows/cgatcore_python.yml index 87138ff5..80a0b09f 100644 --- a/.github/workflows/cgatcore_python.yml +++ b/.github/workflows/cgatcore_python.yml @@ -26,17 +26,25 @@ jobs: CACHE_NUMBER: 0 with: path: ~/conda_pkgs_dir - key: - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('conda/environments/cgat-core.yml') }} + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda/environments/cgat-core.yml') }} + - name: Set installer URL + id: set-installer-url + run: | + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" >> $GITHUB_ENV + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh" >> $GITHUB_ENV + fi - uses: conda-incubator/setup-miniconda@v2 with: + installer-url: ${{ env.installer-url }} python-version: ${{ matrix.python-version }} channels: conda-forge, bioconda, defaults channel-priority: true activate-environment: cgat-core environment-file: conda/environments/cgat-core.yml - miniforge-variant: Mambaforge + - name: Configure Conda Paths + run: echo "/usr/share/miniconda3/condabin" >> $GITHUB_PATH - name: Show conda run: | conda info diff --git a/cgatcore/pipeline/execution.py b/cgatcore/pipeline/execution.py index 1741bb1c..df529871 100644 --- a/cgatcore/pipeline/execution.py +++ b/cgatcore/pipeline/execution.py @@ -1038,10 +1038,16 @@ def _convert(key, v): data.update(dict([(x[0], _convert(x[0], x[1])) for x in pairs if len(x) == 2])) - # remove % sign + cpu_value = data.get("percent_cpu", "0") + # Strip potential '%' symbols, handle non-numeric cases gracefully + try: + percent_cpu = int(re.sub("%", "", cpu_value)) if cpu_value.replace("%", "").strip().isdigit() else 0 + except ValueError: + percent_cpu = 0 # Default or fallback value, adjust as necessary + data.update( - {"percent_cpu": int(re.sub("%", "", data.get("percent_cpu", 0))), - "cpu_t": float(data["user_t"]) + float(data["sys_t"])}) + {"percent_cpu": percent_cpu, + "cpu_t": float(data.get("user_t", 0)) + float(data.get("sys_t", 0))}) return JobInfo(jobId=process.pid, resourceUsage=data)