Skip to content

Commit

Permalink
Merge pull request #76 from dnlbauer/fix_agent_without_name
Browse files Browse the repository at this point in the history
Fix failing conversion if author name is not set
  • Loading branch information
simleo authored Mar 26, 2024
2 parents 8221800 + cbfd4c0 commit c30f31c
Show file tree
Hide file tree
Showing 27 changed files with 2,515 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ authors:
- family-names: Crusoe
given-names: Michael R.
orcid: https://orcid.org/0000-0002-2961-9670
- family-names: Bauer
given-names: Daniel
orcid: https://orcid.org/0000-0001-9447-460X
title: "runcrate"
version: 0.5.0
doi: 10.5281/zenodo.7762627
Expand Down
11 changes: 7 additions & 4 deletions src/runcrate/convert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2022-2024 CRS4.
# Copyright 2023-2024 Michael R. Crusoe
# Copyright 2024 Senckenberg Society for Nature Research
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -472,10 +473,12 @@ def add_agent(self, crate, roc_engine_run, engine):
agent_id = a.identifier.uri
if not agent_id.startswith("http"):
agent_id = "#" + agent_id.rsplit(":", 1)[-1]
ro_a = crate.add(ContextEntity(crate, agent_id, properties={
"@type": "Person",
"name": a.label
}))
properties = {
"@type": "Person"
}
if isinstance(a.label, str):
properties["name"] = a.label
ro_a = crate.add(ContextEntity(crate, agent_id, properties=properties))
roc_engine_run.append_to("agent", ro_a, compact=True)

def add_action(self, crate, activity, parent_instrument=None):
Expand Down
6 changes: 6 additions & 0 deletions tests/data/revsort-no-agent-name-run-1/bag-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bag-Software-Agent: cwltool 3.1.20240112164112
BagIt-Profile-Identifier: https://w3id.org/ro/bagit/profile
Bagging-Date: 2024-03-26
External-Description: Research Object of CWL workflow run
External-Identifier: arcp://uuid,73420c43-a023-4f52-9630-13bcdd9441c2/
Payload-Oxum: 3333.3
2 changes: 2 additions & 0 deletions tests/data/revsort-no-agent-name-run-1/bagit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BagIt-Version: 0.97
Tag-File-Character-Encoding: UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Call me Ishmael. Some years ago--never mind how long precisely--having
little or no money in my purse, and nothing particular to interest me on
shore, I thought I would sail about a little and see the watery part of
the world. It is a way I have of driving off the spleen and regulating
the circulation. Whenever I find myself growing grim about the mouth;
whenever it is a damp, drizzly November in my soul; whenever I find
myself involuntarily pausing before coffin warehouses, and bringing up
the rear of every funeral I meet; and especially whenever my hypos get
such an upper hand of me, that it requires a strong moral principle to
prevent me from deliberately stepping into the street, and methodically
knocking people's hats off--then, I account it high time to get to sea
as soon as I can. This is my substitute for pistol and ball. With a
philosophical flourish Cato throws himself upon his sword; I quietly
take to the ship. There is nothing surprising in this. If they but knew
it, almost all men in their degree, some time or other, cherish very
nearly the same feelings towards the ocean with me.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
gnivah--ylesicerp gnol woh dnim reven--oga sraey emoS .leamhsI em llaC
no em tseretni ot ralucitrap gnihton dna ,esrup ym ni yenom on ro elttil
fo trap yretaw eht ees dna elttil a tuoba lias dluow I thguoht I ,erohs
gnitaluger dna neelps eht ffo gnivird fo evah I yaw a si tI .dlrow eht
;htuom eht tuoba mirg gniworg flesym dnif I revenehW .noitalucric eht
dnif I revenehw ;luos ym ni rebmevoN ylzzird ,pmad a si ti revenehw
pu gnignirb dna ,sesuoheraw niffoc erofeb gnisuap yliratnulovni flesym
teg sopyh ym revenehw yllaicepse dna ;teem I larenuf yreve fo raer eht
ot elpicnirp larom gnorts a seriuqer ti taht ,em fo dnah reppu na hcus
yllacidohtem dna ,teerts eht otni gnippets yletarebiled morf em tneverp
aes ot teg ot emit hgih ti tnuocca I ,neht--ffo stah s'elpoep gnikconk
a htiW .llab dna lotsip rof etutitsbus ym si sihT .nac I sa noos sa
ylteiuq I ;drows sih nopu flesmih sworht otaC hsiruolf lacihposolihp
wenk tub yeht fI .siht ni gnisirprus gnihton si erehT .pihs eht ot ekat
yrev hsirehc ,rehto ro emit emos ,eerged rieht ni nem lla tsomla ,ti
.em htiw naeco eht sdrawot sgnileef emas eht ylraen
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
yrev hsirehc ,rehto ro emit emos ,eerged rieht ni nem lla tsomla ,ti
ylteiuq I ;drows sih nopu flesmih sworht otaC hsiruolf lacihposolihp
yllacidohtem dna ,teerts eht otni gnippets yletarebiled morf em tneverp
wenk tub yeht fI .siht ni gnisirprus gnihton si erehT .pihs eht ot ekat
teg sopyh ym revenehw yllaicepse dna ;teem I larenuf yreve fo raer eht
pu gnignirb dna ,sesuoheraw niffoc erofeb gnisuap yliratnulovni flesym
ot elpicnirp larom gnorts a seriuqer ti taht ,em fo dnah reppu na hcus
no em tseretni ot ralucitrap gnihton dna ,esrup ym ni yenom on ro elttil
gnivah--ylesicerp gnol woh dnim reven--oga sraey emoS .leamhsI em llaC
gnitaluger dna neelps eht ffo gnivird fo evah I yaw a si tI .dlrow eht
fo trap yretaw eht ees dna elttil a tuoba lias dluow I thguoht I ,erohs
dnif I revenehw ;luos ym ni rebmevoN ylzzird ,pmad a si ti revenehw
aes ot teg ot emit hgih ti tnuocca I ,neht--ffo stah s'elpoep gnikconk
a htiW .llab dna lotsip rof etutitsbus ym si sihT .nac I sa noos sa
;htuom eht tuoba mirg gniworg flesym dnif I revenehW .noitalucric eht
.em htiw naeco eht sdrawot sgnileef emas eht ylraen
3 changes: 3 additions & 0 deletions tests/data/revsort-no-agent-name-run-1/manifest-sha1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
327fc7aedf4f6b69a42a7c8b808dc5a7aff61376 data/32/327fc7aedf4f6b69a42a7c8b808dc5a7aff61376
97fe1b50b4582cebc7d853796ebd62e3e163aa3f data/97/97fe1b50b4582cebc7d853796ebd62e3e163aa3f
b9214658cc453331b62c2282b772a5c063dbd284 data/b9/b9214658cc453331b62c2282b772a5c063dbd284
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[2024-03-26T08:34:59,882.000000Z] [cwltool] /home/dbauer/.local/bin/cwltool --provenance testprov revsort.cwl input.yml
[2024-03-26T08:34:59,883.000000Z] Resolved 'revsort.cwl' to 'file:///home/dbauer/projects/runcrate/tests/data/revsort-run-author/snapshot/revsort.cwl'
[2024-03-26T08:35:00,191.000000Z] [provenance] Adding to RO file:///home/dbauer/projects/runcrate/tests/data/revsort-run-author/snapshot/hello.txt
[2024-03-26T08:35:00,192.000000Z] [workflow ] start
[2024-03-26T08:35:00,192.000000Z] [workflow ] starting step rev
[2024-03-26T08:35:00,192.000000Z] [step rev] start
[2024-03-26T08:35:00,204.000000Z] [job rev] /tmp/j235527o$ docker \
run \
-i \
--mount=type=bind,source=/tmp/j235527o,target=/bhhcmi \
--mount=type=bind,source=/tmp/ikqpjjr8,target=/tmp \
--mount=type=bind,source=/home/dbauer/projects/runcrate/tests/data/revsort-run-author/snapshot/hello.txt,target=/var/lib/cwl/stgc6fb3435-bf77-40bf-a2d7-2ce7ffbd3469/hello.txt,readonly \
--workdir=/bhhcmi \
--read-only=true \
--log-driver=none \
--user=1000:1000 \
--rm \
--cidfile=/tmp/crhqjdrm/20240326093500-204573.cid \
--env=TMPDIR=/tmp \
--env=HOME=/bhhcmi \
debian:8 \
rev \
/var/lib/cwl/stgc6fb3435-bf77-40bf-a2d7-2ce7ffbd3469/hello.txt > /tmp/j235527o/output.txt
[2024-03-26T08:35:01,207.000000Z] [job rev] completed success
[2024-03-26T08:35:01,207.000000Z] [step rev] completed success
[2024-03-26T08:35:01,207.000000Z] [workflow ] starting step sorted
[2024-03-26T08:35:01,207.000000Z] [step sorted] start
[2024-03-26T08:35:01,209.000000Z] [job sorted] /tmp/eo0fu8e3$ docker \
run \
-i \
--mount=type=bind,source=/tmp/eo0fu8e3,target=/bhhcmi \
--mount=type=bind,source=/tmp/2bhihxc0,target=/tmp \
--mount=type=bind,source=/tmp/j235527o/output.txt,target=/var/lib/cwl/stg35a7c99e-7809-482d-92a1-712ed8215b58/output.txt,readonly \
--workdir=/bhhcmi \
--read-only=true \
--log-driver=none \
--user=1000:1000 \
--rm \
--cidfile=/tmp/0gcyad43/20240326093501-209419.cid \
--env=TMPDIR=/tmp \
--env=HOME=/bhhcmi \
debian:8 \
sort \
--reverse \
/var/lib/cwl/stg35a7c99e-7809-482d-92a1-712ed8215b58/output.txt > /tmp/eo0fu8e3/output.txt
[2024-03-26T08:35:02,211.000000Z] [job sorted] completed success
[2024-03-26T08:35:02,211.000000Z] [step sorted] completed success
[2024-03-26T08:35:02,212.000000Z] [workflow ] completed success
[2024-03-26T08:35:02,250.000000Z] Final process status is success
Loading

0 comments on commit c30f31c

Please sign in to comment.