Skip to content

Commit

Permalink
Merge pull request #181 from cgat-developers/AC-miniforge
Browse files Browse the repository at this point in the history
mambaforge is depricated and need miniforge for action builds
  • Loading branch information
Acribbs authored Nov 10, 2024
2 parents e9d153a + 9542a1b commit b2d768e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/cgatcore_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions cgatcore/pipeline/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b2d768e

Please sign in to comment.