Skip to content

Commit 2bc176a

Browse files
committed
Fix issue 55
1 parent bed9693 commit 2bc176a

File tree

5 files changed

+61
-167
lines changed

5 files changed

+61
-167
lines changed

.github/workflows/run-benchmark.yml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -129,34 +129,32 @@ jobs:
129129
shell: bash -l {0}
130130
continue-on-error: true
131131
run: |
132-
LOG_FILE=rohub_upload_error.log
133-
134-
# Run Python and capture all stdout+stderr
135-
python benchmarks/common/upload_provenance.py \
136-
--provenance_folderpath "./${SNAKEMAKE_RESULT_FILE}.zip" \
137-
--benchmark_name "linear-elastic-plate-with-hole" \
138-
--username "${{ secrets.ROHUB_USERNAME }}" \
139-
--password "${{ secrets.ROHUB_PASSWORD }}" \
140-
2>&1 | tee "$LOG_FILE"
141-
142-
PYTHON_EXIT_CODE=${PIPESTATUS[0]}
143-
144-
# Check exit code: 0 = failure, 1 = success (per your convention)
145-
if [ $PYTHON_EXIT_CODE -eq 0 ]; then
146-
echo "=== RoHub upload failed — see log below ==="
147-
cat "$LOG_FILE"
132+
LOG_FILE="${GITHUB_WORKSPACE}/rohub_upload_error.log"
133+
134+
# Run Python and capture stdout+stderr
135+
OUTPUT="$(
136+
python benchmarks/common/upload_provenance.py \
137+
--provenance_folderpath "./${SNAKEMAKE_RESULT_FILE}.zip" \
138+
--benchmark_name "linear-elastic-plate-with-hole" \
139+
--username "${{ secrets.ROHUB_USERNAME }}" \
140+
--password "${{ secrets.ROHUB_PASSWORD }}" \
141+
2>&1
142+
)"
143+
PYTHON_EXIT_CODE=$?
144+
145+
# Standard convention: 0 = success, non-zero = failure
146+
if [ "$PYTHON_EXIT_CODE" -eq 0 ]; then
147+
echo "RoHub upload succeeded"
148+
rm -f "$LOG_FILE" || true
148149
else
149-
echo " RoHub upload succeeded"
150-
rm -f "$LOG_FILE"
150+
echo "=== RoHub upload failed — writing log to $LOG_FILE ==="
151+
printf '%s\n' "$OUTPUT" | tee "$LOG_FILE"
151152
fi
152153
153-
# Export exit code for subsequent steps if needed
154-
echo "python_exit_code=$PYTHON_EXIT_CODE" >> $GITHUB_ENV
155-
156154
- name: Upload RoHub error log
157-
if: ${{ env.python_exit_code == '0' }}
155+
if: always()
158156
uses: actions/upload-artifact@v4
159157
with:
160158
name: rohub-upload-error-log
161-
path: rohub_upload_error.log
162-
159+
path: ${{ github.workspace }}/rohub_upload_error.log
160+
if-no-files-found: ignore

benchmarks/common/provenance.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ def build_dynamic_query(self, parameters, metrics, tools=None, named_graph=None)
151151
PREFIX schema: <http://schema.org/>
152152
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
153153
PREFIX m4i: <http://w3id.org/nfdi4ing/metadata4ing#>
154-
PREFIX ssn: <http://www.w3.org/ns/ssn/>
155154
156155
SELECT {select_vars} ?tool_name
157156
WHERE {{
@@ -273,4 +272,4 @@ def validate_provenance(self):
273272
for issue in result.get_issues()
274273
)
275274

276-
print("RO-Crate is valid!")
275+
print("RO-Crate is valid!")

benchmarks/common/upload_provenance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ def main():
199199
args = parse_args()
200200
try:
201201
run(args)
202-
sys.exit(1)
202+
sys.exit(0)
203203
except Exception as error:
204-
print("⚠️ RoHub upload failed:")
204+
print("RoHub upload failed:")
205205
print(error)
206-
sys.exit(0)
206+
sys.exit(1)
207207

208208

209209
if __name__ == "__main__":

benchmarks/notebooks/RoCrate.ipynb

Lines changed: 34 additions & 137 deletions
Large diffs are not rendered by default.

environment_benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ dependencies:
1111
- conda
1212
- pip
1313
- pip:
14-
- "git+https://github.com/izus-fokus/snakemake-report-plugin-metadata4ing@v1.2.3#egg=snakemake-report-plugin-metadata4ing"
14+
- "git+https://github.com/izus-fokus/snakemake-report-plugin-metadata4ing@v1.2.5#egg=snakemake-report-plugin-metadata4ing"

0 commit comments

Comments
 (0)