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

exit_hook in Task not scanned for environment variables #32

Open
lotruheawea opened this issue Nov 7, 2023 · 1 comment
Open

exit_hook in Task not scanned for environment variables #32

lotruheawea opened this issue Nov 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lotruheawea
Copy link

lotruheawea commented Nov 7, 2023

What happened?

When a user defines a custom exit_hook for a given Task, contained ecFlow variables are not exported to environment variables:
I guess the library needs to be adjusted in nodes.py line 1321 from
all_scripts = "\n".join(script + workdir_lines + module_lines)
to
all_scripts = "\n".join(script + workdir_lines + module_lines + self._exit_hook)

What are the steps to reproduce the bug?

import pyflow as pf

with pf.Suite('hello_pyflow',
              host=pf.SLURMHost('foo'),
              files='/home/username/tmp/',
              MY_VAR='bar',
) as s:
    pf.Label('greeting', '')
    pf.Edit(HOOK_VAR='foo')
    t1 = pf.Task('t1', script='echo "I am on $(hostname) : $ECF_HOST, $MY_VAR"', exit_hook='echo ${HOOK_VAR}')
s.deploy_suite(overwrite=True)

Version

v3.1.0

Platform (OS and architecture)

Linux ac6-101.bullx 4.18.0-372.52.1.el8_6.x86_64 #1 SMP Fri Mar 31 06:22:44 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

Relevant log output

No response

Accompanying data

No response

Organisation

No response

@lotruheawea lotruheawea added the bug Something isn't working label Nov 7, 2023
@corentincarton
Copy link
Collaborator

Hi @lotruheawea, sorry for the late answer. As the exit hook is not part of the core script, so you should be able to use ecflow variables directly there: exit_hook='echo %HOOK_VAR%'. Exporting the ecflow variable wouldn't help as they are exported after the definition of the exit hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants