diff --git a/workflow/Snakefile b/workflow/Snakefile index 7a9c16f..1a99611 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -79,8 +79,7 @@ rule run_ecg: input: "flake.nix", "flake.lock", - ecg="ecg.py", - ecg_wrapper="workflow/scripts/ecg_wrapper.sh", + ecg="ecg/app/ecg.py", execo_wrapper="workflow/scripts/submission_g5k.py", oar_wrapper="workflow/scripts/ecg_oar_wrapper.oar.bash", artifact=f"{ARTIFACTS_FOLDER_JSON}/{{artifact}}.{EXTENSION}" @@ -90,7 +89,20 @@ rule run_ecg: build_status = f"{PREFIX}/build_status/{{artifact}}/{{date}}.csv", artifact_hash = f"{PREFIX}/artifact_hash/{{artifact}}/{{date}}.csv", shell: - (SHELLS_ECG["g5k"] if SYSTEM == "g5k" else "") + SHELLS_ECG["local"] + ("'" if SYSTEM == "g5k" else "") + (f"python3 {{input.execo_wrapper}} --path {os.getcwd()} \ + --script {{input.oar_wrapper}} \ + --site {config['site']} \ + --cluster {config['cluster']} \ + --max-duration {config['max_duration']} \ + --checkpoint {config['checkpoint']} \ + {'--besteffort' if config['besteffort'] else ''} \ + --sleep_time {config['sleep_time']} \ + --build_status_file {{output.build_status}} \ + --artifact {{wildcards.artifact}} -- '" if SYSTEM == "g5k" else "") + \ + """ + nix develop .#ecg-shell --command ecg -p {output.pkg} -b {output.build_status} -a {output.artifact_hash} {output.artifact} &> {output.log} || echo "{input.artifact}, `date +%s.%N`, script_crash" > {output.build_status} + """ + \ + ("'" if SYSTEM == "g5k" else "") rule update_blacklist: input: diff --git a/workflow/scripts/ecg_oar_wrapper.oar.bash b/workflow/scripts/ecg_oar_wrapper.oar.bash index 6d5238e..bef502f 100755 --- a/workflow/scripts/ecg_oar_wrapper.oar.bash +++ b/workflow/scripts/ecg_oar_wrapper.oar.bash @@ -17,7 +17,7 @@ export PATH=~/.local/bin:$PATH g5k-setup-docker -t handler() { - echo "${ARTIFACT_FILE}, `date +%s.%N`, job_time_exceeded" >> ${BUILD_STATUS_FILE}; exit 0; + echo "${ARTIFACT_FILE}, `date +%s.%N`, job_time_exceeded" > ${BUILD_STATUS_FILE}; exit 0; } trap handler SIGUSR2 diff --git a/workflow/scripts/ecg_wrapper.sh b/workflow/scripts/ecg_wrapper.sh deleted file mode 100755 index 4195316..0000000 --- a/workflow/scripts/ecg_wrapper.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -ECG=$1 -CONFIG=$2 -PKGLIST=$3 -BUILD_STATUS=$4 -ARTHASH_LOG=$5 -OUTPUT_LOG=$6 - -python3 $ECG -p $PKGLIST -b $BUILD_STATUS -a $ARTHASH_LOG $CONFIG > $OUTPUT_LOG 2> $OUTPUT_LOG -if [ $? -ne 0 ] -then - echo "${CONFIG}, `date +%s.%N`, script_crash" >> ${BUILD_STATUS}; exit 0; -fi