Skip to content

Commit

Permalink
Merge pull request #72 from simleo/sw_req
Browse files Browse the repository at this point in the history
Convert SoftwareRequirement
  • Loading branch information
simleo authored Nov 24, 2023
2 parents 72d6f21 + fdea0ab commit 9b302ad
Show file tree
Hide file tree
Showing 31 changed files with 2,336 additions and 2,279 deletions.
7 changes: 7 additions & 0 deletions cwl/grepucase/greptool.cwl
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
class: CommandLineTool
cwlVersion: v1.0

hints:
SoftwareRequirement:
packages:
grep:
specs: ["https://www.gnu.org/software/grep/"]
version: ["3.8"]

baseCommand: ["bash", "-c"]

inputs:
Expand Down
18 changes: 18 additions & 0 deletions src/runcrate/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,31 @@ def add_tool(self, crate, workflow, cwl_tool):
ramMin = req.ramMin
if ramMin:
properties["memoryRequirements"] = f"{int(ramMin)} MiB"
deps = []
if hasattr(cwl_tool, "hints") and cwl_tool.hints:
for req in cwl_tool.hints:
if hasattr(req, "class_") and req.class_ == "ResourceRequirement":
ramMin = req.ramMin
if ramMin:
properties["memoryRequirements"] = f"{int(ramMin)} MiB"
if hasattr(req, "class_") and req.class_ == "SoftwareRequirement":
for p in req.packages:
if hasattr(p, "specs") and p.specs:
dep_id = p.specs[0]
dep_properties = {
"@type": "SoftwareApplication",
"name": p.package
}
if p.version:
dep_properties["softwareVersion"] = p.version
deps.append(
crate.add(ContextEntity(crate, dep_id, properties=dep_properties))
)
tool = crate.add(ContextEntity(crate, tool_id, properties=properties))
if deps:
tool["softwareRequirements"] = deps
if len(deps) == 1:
tool["mainEntity"] = deps[0]
tool["input"] = self.add_params(crate, cwl_tool.inputs)
tool["output"] = self.add_params(crate, cwl_tool.outputs)
workflow.append_to("hasPart", tool)
Expand Down
6 changes: 3 additions & 3 deletions tests/data/grepucase-run-1/bag-info.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bag-Software-Agent: cwltool 3.1.20230213100550
Bag-Software-Agent: cwltool 3.1.20231020140205
BagIt-Profile-Identifier: https://w3id.org/ro/bagit/profile
Bagging-Date: 2023-02-17
Bagging-Date: 2023-11-22
External-Description: Research Object of CWL workflow run
External-Identifier: arcp://uuid,422fecc5-1e57-45bc-a653-1513a7a6fe70/
External-Identifier: arcp://uuid,03322031-8508-4afe-94a8-0198cc6b81f0/
Payload-Oxum: 151.7
6 changes: 3 additions & 3 deletions tests/data/grepucase-run-1/manifest-sha1.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
8d84ef91f0aba379f5edc3836b4b5f6727920f22 data/8d/8d84ef91f0aba379f5edc3836b4b5f6727920f22
d60dd58346cf7e533252f35399cd510b1b1467f7 data/d6/d60dd58346cf7e533252f35399cd510b1b1467f7
8d84ef91f0aba379f5edc3836b4b5f6727920f22 data/8d/8d84ef91f0aba379f5edc3836b4b5f6727920f22
1078cf414b2625a240b16392085d66580bb66f4d data/10/1078cf414b2625a240b16392085d66580bb66f4d
8545949f96b96cb721485066bafad9b768bc4e52 data/85/8545949f96b96cb721485066bafad9b768bc4e52
5aa9aa3b336778cf2a7db648fc530892c3b3dabb data/5a/5aa9aa3b336778cf2a7db648fc530892c3b3dabb
3ccdc7533084b641e6c941cc6dbb091d2e5f8a41 data/3c/3ccdc7533084b641e6c941cc6dbb091d2e5f8a41
8545949f96b96cb721485066bafad9b768bc4e52 data/85/8545949f96b96cb721485066bafad9b768bc4e52
ec0270052a78321508502ed915815c4daf75fe46 data/ec/ec0270052a78321508502ed915815c4daf75fe46
3ccdc7533084b641e6c941cc6dbb091d2e5f8a41 data/3c/3ccdc7533084b641e6c941cc6dbb091d2e5f8a41
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix id: <urn:uuid:> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:be8d4460-90f6-43c5-8287-ceab31972de2 a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "bar.out"^^xsd:string ;
ore:proxyFor id:a9ab8653-e354-4b7c-9bf8-0ae63766739b ;
ore:proxyIn id:107dd13d-3630-4e81-bd71-026b638facbc .

id:f2ecfe9a-f8cc-4a93-be80-f432fe07c9fc a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "foo.out"^^xsd:string ;
ore:proxyFor id:79a136c8-0972-4775-a580-7bbcc534560e ;
ore:proxyIn id:107dd13d-3630-4e81-bd71-026b638facbc .

id:107dd13d-3630-4e81-bd71-026b638facbc a ro:Folder,
ore:Aggregation,
prov:Entity ;
ore:aggregates id:be8d4460-90f6-43c5-8287-ceab31972de2,
id:f2ecfe9a-f8cc-4a93-be80-f432fe07c9fc .

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix id: <urn:uuid:> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:2075729e-b057-4fdc-9c86-09311d9c0ecc a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "foo.out"^^xsd:string ;
ore:proxyFor id:ddf09a83-68c1-43e9-b94f-014037afe00c ;
ore:proxyIn id:4ed2e115-3819-4223-b391-50c40fa8e7df .

id:7470117c-b551-42be-8b7a-8185375db7e7 a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "bar.out"^^xsd:string ;
ore:proxyFor id:6e4a760b-51e7-472a-b732-fd31c1acf858 ;
ore:proxyIn id:4ed2e115-3819-4223-b391-50c40fa8e7df .

id:4ed2e115-3819-4223-b391-50c40fa8e7df a ro:Folder,
ore:Aggregation,
prov:Entity ;
ore:aggregates id:2075729e-b057-4fdc-9c86-09311d9c0ecc,
id:7470117c-b551-42be-8b7a-8185375db7e7 .

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix id: <urn:uuid:> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:95b7c437-983d-496b-9f5d-76920586668e a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "foo"^^xsd:string ;
ore:proxyFor id:fb8bdb45-b85e-4fa3-b385-26bb40577340 ;
ore:proxyIn id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba .

id:caf7defd-a8f4-4bb7-9961-02ff95d40c76 a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "bar"^^xsd:string ;
ore:proxyFor id:92d8ca48-5172-458e-901e-5763cf093663 ;
ore:proxyIn id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba .

id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba a ro:Folder,
ore:Aggregation,
prov:Entity ;
ore:aggregates id:95b7c437-983d-496b-9f5d-76920586668e,
id:caf7defd-a8f4-4bb7-9961-02ff95d40c76 .

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:7329bf41-05c0-4881-8bd3-1203a530f736 a ro:FolderEntry,
ore:Proxy,
id:79a136c8-0972-4775-a580-7bbcc534560e a ro:Folder,
ore:Aggregation,
prov:Entity ;
ro:entryName "foo.out.out"^^xsd:string ;
ore:proxyFor id:cb12bf67-5541-4f8c-b897-47a87e11a242 ;
ore:proxyIn id:bea1dc23-0537-4874-82ce-454f48c08d0a .
ore:aggregates id:d72a309c-26f9-422c-a812-74127256c8a2 .

id:bea1dc23-0537-4874-82ce-454f48c08d0a a ro:Folder,
ore:Aggregation,
id:d72a309c-26f9-422c-a812-74127256c8a2 a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ore:aggregates id:7329bf41-05c0-4881-8bd3-1203a530f736 .
ro:entryName "foo.out.out"^^xsd:string ;
ore:proxyFor id:b604cd9a-7a66-4bf2-83fc-b61b515b06bb ;
ore:proxyIn id:79a136c8-0972-4775-a580-7bbcc534560e .

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix id: <urn:uuid:> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:4e117ee5-4bcb-41be-a18a-98163d76839f a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "foo"^^xsd:string ;
ore:proxyFor id:cb8da8f0-ac68-4ee4-96be-e7251eee8743 ;
ore:proxyIn id:99571210-dcea-4991-bc3d-64b28f87a0d7 .

id:e4231925-b712-419b-89c9-feb7468faf0d a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "bar"^^xsd:string ;
ore:proxyFor id:608f6a9a-4d1f-4255-9424-328b4f68a291 ;
ore:proxyIn id:99571210-dcea-4991-bc3d-64b28f87a0d7 .

id:99571210-dcea-4991-bc3d-64b28f87a0d7 a ro:Folder,
ore:Aggregation,
prov:Entity ;
ore:aggregates id:4e117ee5-4bcb-41be-a18a-98163d76839f,
id:e4231925-b712-419b-89c9-feb7468faf0d .

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:899d951e-0ef0-42a7-a460-3cf4c3b3aff5 a ro:FolderEntry,
id:0928d1de-6468-4558-8787-f8fef8fc3384 a ro:FolderEntry,
ore:Proxy,
prov:Entity ;
ro:entryName "bar.out.out"^^xsd:string ;
ore:proxyFor id:2c6ae84c-c98c-4173-aa24-44b9bb21d372 ;
ore:proxyIn id:8cb9abec-9ecf-4e54-86b5-7f08a073ce60 .
ore:proxyFor id:124c0ca7-05d4-4867-9770-7dde9ed93a52 ;
ore:proxyIn id:a9ab8653-e354-4b7c-9bf8-0ae63766739b .

id:8cb9abec-9ecf-4e54-86b5-7f08a073ce60 a ro:Folder,
id:a9ab8653-e354-4b7c-9bf8-0ae63766739b a ro:Folder,
ore:Aggregation,
prov:Entity ;
ore:aggregates id:899d951e-0ef0-42a7-a460-3cf4c3b3aff5 .
ore:aggregates id:0928d1de-6468-4558-8787-f8fef8fc3384 .

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[2023-11-22T14:00:34,368.000000Z] [cwltool] /home/simleo/git/runcrate/venv/bin/cwltool --provenance ro grepucase.cwl grepucase-job.yml
[2023-11-22T14:00:34,370.000000Z] Resolved 'grepucase.cwl' to 'file:///home/simleo/git/runcrate/cwl/grepucase/grepucase.cwl'
[2023-11-22T14:00:34,662.000000Z] [provenance] Adding to RO file:///home/simleo/git/runcrate/cwl/grepucase/grepucase_in/foo
[2023-11-22T14:00:34,663.000000Z] [provenance] Adding to RO file:///home/simleo/git/runcrate/cwl/grepucase/grepucase_in/bar
[2023-11-22T14:00:34,674.000000Z] [workflow ] start
[2023-11-22T14:00:34,674.000000Z] [workflow ] starting step grep
[2023-11-22T14:00:34,674.000000Z] [step grep] start
[2023-11-22T14:00:34,676.000000Z] [job grep] /tmp/vkckwf2j$ bash \
-c \
'mkdir -p grep_out
find /tmp/c3z_ayvp/stgbd555114-f2e4-41d0-88aa-b579666d7084/grepucase_in/ -type f | while read f; do
grep lazy ${f} > grep_out/`basename ${f}`.out
done'
[2023-11-22T14:00:34,693.000000Z] [job grep] completed success
[2023-11-22T14:00:34,693.000000Z] [step grep] completed success
[2023-11-22T14:00:34,693.000000Z] [workflow ] starting step ucase
[2023-11-22T14:00:34,693.000000Z] [step ucase] start
[2023-11-22T14:00:34,695.000000Z] [job ucase] /tmp/nozkr02w$ bash \
-c \
'mkdir -p ucase_out
find /tmp/4vfdgmw2/stg829c996f-6110-4091-90e8-9075cabe7301/grep_out/ -type f | while read f; do
mkdir ucase_out/`basename ${f}`
awk '"'"'{print toupper($0)}'"'"' < ${f} > ucase_out/`basename ${f}`/`basename ${f}`.out
done'
[2023-11-22T14:00:34,717.000000Z] [job ucase] completed success
[2023-11-22T14:00:34,718.000000Z] [step ucase] completed success
[2023-11-22T14:00:34,718.000000Z] [workflow ] completed success
[2023-11-22T14:00:34,768.000000Z] Final process status is success
Loading

0 comments on commit 9b302ad

Please sign in to comment.