Skip to content

Commit be693f9

Browse files
committed
Merge branch 'master' into AC-aws
2 parents c1e8b3a + b2d768e commit be693f9

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

.github/workflows/cgatcore_python.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,25 @@ jobs:
2626
CACHE_NUMBER: 0
2727
with:
2828
path: ~/conda_pkgs_dir
29-
key:
30-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
31-
hashFiles('conda/environments/cgat-core.yml') }}
29+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda/environments/cgat-core.yml') }}
30+
- name: Set installer URL
31+
id: set-installer-url
32+
run: |
33+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
34+
echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" >> $GITHUB_ENV
35+
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
36+
echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh" >> $GITHUB_ENV
37+
fi
3238
- uses: conda-incubator/setup-miniconda@v2
3339
with:
40+
installer-url: ${{ env.installer-url }}
3441
python-version: ${{ matrix.python-version }}
3542
channels: conda-forge, bioconda, defaults
3643
channel-priority: true
3744
activate-environment: cgat-core
3845
environment-file: conda/environments/cgat-core.yml
39-
miniforge-variant: Mambaforge
46+
- name: Configure Conda Paths
47+
run: echo "/usr/share/miniconda3/condabin" >> $GITHUB_PATH
4048
- name: Show conda
4149
run: |
4250
conda info

cgatcore/pipeline/execution.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,10 +1038,16 @@ def _convert(key, v):
10381038
data.update(dict([(x[0], _convert(x[0], x[1]))
10391039
for x in pairs if len(x) == 2]))
10401040

1041-
# remove % sign
1041+
cpu_value = data.get("percent_cpu", "0")
1042+
# Strip potential '%' symbols, handle non-numeric cases gracefully
1043+
try:
1044+
percent_cpu = int(re.sub("%", "", cpu_value)) if cpu_value.replace("%", "").strip().isdigit() else 0
1045+
except ValueError:
1046+
percent_cpu = 0 # Default or fallback value, adjust as necessary
1047+
10421048
data.update(
1043-
{"percent_cpu": int(re.sub("%", "", data.get("percent_cpu", 0))),
1044-
"cpu_t": float(data["user_t"]) + float(data["sys_t"])})
1049+
{"percent_cpu": percent_cpu,
1050+
"cpu_t": float(data.get("user_t", 0)) + float(data.get("sys_t", 0))})
10451051

10461052
return JobInfo(jobId=process.pid, resourceUsage=data)
10471053

0 commit comments

Comments
 (0)