Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions .github/workflows/run-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,34 +129,32 @@ jobs:
shell: bash -l {0}
continue-on-error: true
run: |
LOG_FILE=rohub_upload_error.log

# Run Python and capture all stdout+stderr
python benchmarks/common/upload_provenance.py \
--provenance_folderpath "./${SNAKEMAKE_RESULT_FILE}.zip" \
--benchmark_name "linear-elastic-plate-with-hole" \
--username "${{ secrets.ROHUB_USERNAME }}" \
--password "${{ secrets.ROHUB_PASSWORD }}" \
2>&1 | tee "$LOG_FILE"

PYTHON_EXIT_CODE=${PIPESTATUS[0]}

# Check exit code: 0 = failure, 1 = success (per your convention)
if [ $PYTHON_EXIT_CODE -eq 0 ]; then
echo "=== RoHub upload failed — see log below ==="
cat "$LOG_FILE"
LOG_FILE="${GITHUB_WORKSPACE}/rohub_upload_error.log"

# Run Python and capture stdout+stderr
OUTPUT="$(
python benchmarks/common/upload_provenance.py \
--provenance_folderpath "./${SNAKEMAKE_RESULT_FILE}.zip" \
--benchmark_name "linear-elastic-plate-with-hole" \
--username "${{ secrets.ROHUB_USERNAME }}" \
--password "${{ secrets.ROHUB_PASSWORD }}" \
2>&1
)"
PYTHON_EXIT_CODE=$?

# Standard convention: 0 = success, non-zero = failure
if [ "$PYTHON_EXIT_CODE" -eq 0 ]; then
echo "RoHub upload succeeded"
rm -f "$LOG_FILE" || true
else
echo " RoHub upload succeeded"
rm -f "$LOG_FILE"
echo "=== RoHub upload failed — writing log to $LOG_FILE ==="
printf '%s\n' "$OUTPUT" | tee "$LOG_FILE"
fi

# Export exit code for subsequent steps if needed
echo "python_exit_code=$PYTHON_EXIT_CODE" >> $GITHUB_ENV

- name: Upload RoHub error log
if: ${{ env.python_exit_code == '0' }}
if: always()
uses: actions/upload-artifact@v4
with:
name: rohub-upload-error-log
path: rohub_upload_error.log

path: ${{ github.workspace }}/rohub_upload_error.log
if-no-files-found: ignore
7 changes: 4 additions & 3 deletions benchmarks/common/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def build_dynamic_query(self, parameters, metrics, tools=None, named_graph=None)
)

# Tool block with optional filter
tool_block = "?method m4i:implementedByTool ?tool .\n?tool a schema:SoftwareApplication ;\n rdfs:label ?tool_name .\n"
tool_predicate = "ssn:implementedBy" if named_graph else "m4i:implementedByTool"
tool_block = f"?method {tool_predicate} ?tool .\n?tool a schema:SoftwareApplication ;\n rdfs:label ?tool_name .\n"
if tools:
filter_cond = " || ".join(
f'CONTAINS(LCASE(?tool_name), "{t.lower()}")' for t in tools
Expand Down Expand Up @@ -152,7 +153,7 @@ def build_dynamic_query(self, parameters, metrics, tools=None, named_graph=None)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX m4i: <http://w3id.org/nfdi4ing/metadata4ing#>
PREFIX ssn: <http://www.w3.org/ns/ssn/>

SELECT {select_vars} ?tool_name
WHERE {{
{where_block}
Expand Down Expand Up @@ -273,4 +274,4 @@ def validate_provenance(self):
for issue in result.get_issues()
)

print("RO-Crate is valid!")
print("RO-Crate is valid!")
6 changes: 3 additions & 3 deletions benchmarks/common/upload_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ def main():
args = parse_args()
try:
run(args)
sys.exit(1)
sys.exit(0)
except Exception as error:
print("⚠️ RoHub upload failed:")
print("RoHub upload failed:")
print(error)
sys.exit(0)
sys.exit(1)


if __name__ == "__main__":
Expand Down
193 changes: 42 additions & 151 deletions benchmarks/notebooks/RoCrate.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion environment_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ dependencies:
- conda
- pip
- pip:
- "git+https://github.com/izus-fokus/snakemake-report-plugin-metadata4ing@v1.2.3#egg=snakemake-report-plugin-metadata4ing"
- "git+https://github.com/izus-fokus/snakemake-report-plugin-metadata4ing@v1.2.5#egg=snakemake-report-plugin-metadata4ing"
Loading