ResearchObject / workflow-run-crate

Workflow Run RO-Crate profile
https://www.researchobject.org/workflow-run-crate/
Apache License 2.0
8 stars 9 forks source link

Representing environment variables #62

Closed simleo closed 8 months ago

simleo commented 1 year ago

Both in the prospective provenance (what's the name of the variable that a workflow or tool needs?) and the retrospective one (what was the value).

Also, how to hide the value if it's sensitive.

Brought up by @jmfernandez

mr-c commented 11 months ago

I guess this could be modeled as a list of https://schema.org/PropertyValue where the PropertyValue.name is the environment variable name (like ALGORITHM_OVERRIDE) and the PropertyValue.value is the actual string value used (revised in this made-up example).

simleo commented 11 months ago

PropertyValue using name and value seems a good choice for the retrospective part. For the prospective part, where there is no value and the focus is on the name / type, it seems less straightforward. Additionally, we need a way to link them to the tool / workflow (prospective) or action (retrospective). There are analogies with workflow / tool parameters.

jmfernandez commented 11 months ago

Both ComputationalTool and ComputationalWorkflow have input, which is a list of FormalParameter.

I think we should also represent environment variables as FormalParameters, but extending both ComputationalWorkflow and ComputationalTool in order to have an additional property environment, where to list the possible environment variables as FormalParameter. Then, depending on whether it is either the prospective or the retrospective provenance being represented, those instances of FormalParameter will or wont have listed the values at through workExample property.

simleo commented 11 months ago

If env vars are represented as FormalParameter on the prospective side, then they should probably be represented by PropertyValue on the retrospective side. These should be listed in the relevant CreateAction, but with which property? Reuse environment?

simleo commented 11 months ago

Here' s how it would look like (BTW, ComputationalTool is not in the RO-Crate context, we're using SoftwareApplication for tools):

{
    "@id": "foo.cwl",
    "@type": "SoftwareApplication",
    ...
    "environment": [
        {"@id": "foo.cwl#api_token"}
    ]
},
{
    "@id": "foo.cwl#api_token",
    "@type": "FormalParameter",
    "additionalType": "Text",
    "name": "API_TOKEN",
},
{
    "@id": "#cb04c897-eb92-4c53-8a38-bcc1a16fd650",
    "@type": "CreateAction",
    "instrument": {"@id": "foo.cwl"},
    ...
    "environment": [
        {"@id": "#api_token-pv"}
    ]
},
{
    "@id": "#api_token-pv",
    "@type": "PropertyValue",
    "exampleOfWork": {"@id": "foo.cwl#api_token"},
    "name": "API_TOKEN",
    "value": "nGh9_v8nhv8h49388a44w89hK_aof0q"
}