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

[BUG] conda activation crashes standalone execution #3

Closed
francois-rozet opened this issue Dec 30, 2021 · 1 comment
Closed

[BUG] conda activation crashes standalone execution #3

francois-rozet opened this issue Dec 30, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@francois-rozet
Copy link
Collaborator

francois-rozet commented Dec 30, 2021

Issue description

In the standalone backend on Unix systems, the os.system(command) used here

if node.tasks > 1:
for task_index in range(node.tasks):
task_command = command + ' ' + str(task_index)
return_code = os.system(task_command)
if return_code != 0:
break
else:
return_code = os.system(command)

actually calls /bin/sh. For some OS, like Ubuntu, sh links to dash which does not support the scripting features required by conda activations. This results in runtime errors like

sh: 5: /home/username/miniconda3/envs/envname/etc/conda/activate.d/activate-binutils_linux-64.sh: Syntax error: "(" unexpected

Proposed solution

A solution would be to change the shell with which the commands are called. This is possible thanks to the subprocess package. A good default would be bash as almost all Unix systems use it.

    if node.tasks > 1:
        for task_index in range(node.tasks):
            task_command = command + ' ' + str(task_index)
            return_code = subprocess.call(task_command, shell=True, executable='/bin/bash')
    else:
        return_code = subprocess.call(command, shell=True, executable='/bin/bash')

One could also add a way to change this default. Additionally, wouldn't it be better to launch the tasks as background jobs for the standalone backend (simply add & at the end of the command) ?

@francois-rozet francois-rozet changed the title [BUG] conda environment activation crash standalone execution [BUG] conda activation crashes standalone execution Dec 30, 2021
@francois-rozet francois-rozet added the bug Something isn't working label Dec 30, 2021
@JoeriHermans
Copy link
Owner

Fixed in next version with breaking API changes. https://github.com/JoeriHermans/awflow/tree/dawgz

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