Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique names for gathered outputs int shell tasks #124

Open
agoscinski opened this issue Mar 13, 2025 · 0 comments
Open

Unique names for gathered outputs int shell tasks #124

agoscinski opened this issue Mar 13, 2025 · 0 comments
Assignees

Comments

@agoscinski
Copy link
Collaborator

from aiida_workgraph import WorkGraph
from aiida import load_profile
load_profile()

script_content = """#!/bin/bash
echo "content" > file
"""
from pathlib import Path
script_path = Path("script.sh")
script_path.write_text(script_content)
script = str(script_path.resolve())
# chmod u+x

wg = WorkGraph(name="gather_problem")
date_task1 = wg.add_task("ShellJob", command=script, outputs=["file"])
date_task2 = wg.add_task("ShellJob", command=script, outputs=["file"])


analyze_content = """#!/bin/bash
echo "content" > analyze
"""
analyze_path = Path("analyze.sh")
analyze_path.write_text(analyze_content)
analyze = str(analyze_path.resolve())
# chmod u+x

analyze_task_gather = wg.add_task("ShellJob", command=analyze,
                    #arguments=["--op=SOMEARG SO", "{arg1}", "{arg2}"], # WORKS
                    #arguments="--op=SOMEARG {arg1} {arg2}", # WORKS
                    command="bash",
                    arguments="script.sh --op={arg1} {arg2}", # WORKS?
                    #arguments=["--op=SOMEARG {arg1} {arg2}"], # WORKS NOT
                    #arguments=["--op={arg1}", "{arg2}"], # WORKS
                    nodes={"arg1": date_task1.outputs.file,
                           "arg2": date_task2.outputs.file})
                    
wg.run()

Raise error somewhere in aiida

I think aiida-shell/aiida-core should raise an error when seeing this and we should then reraise to make the user aware

Support environment variables user can give unique names

The user needs to do scripts like this

script_content = """#!/bin/bash
echo "content" > file_${SIROCCO_CURRENT_DATE}

We could just introduce environments in prepend text

    metadata={
        'options': {
            'prepend_text': 'export SIROCCO_DATE=...'
        }
    }
)

Extending to any sirocco coordinate specified the user

Support something like this SIROCCO_COORDINATE_{USER_PARAM}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants