Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mambaforge is depricated and need miniforge for action builds #181

Merged
merged 9 commits into from
Nov 10, 2024
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
Loading