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

Wrapping dispatcher commands in a shell #390

Merged
merged 2 commits into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions fedn/fedn/utils/dispatcher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re
import logging
from fedn.utils.process import run_process
import shlex

logger = logging.getLogger(__name__)

Expand All @@ -23,13 +22,16 @@ def run_cmd(self, cmd_type):
try:
cmdsandargs = cmd_type.split(' ')

cmd = shlex.split(self.config['entry_points'][cmdsandargs[0]]['command'])
cmd = [self.config['entry_points'][cmdsandargs[0]]['command']]

# remove the first element, that is not a file but a command
args = cmdsandargs[1:]

# shell (this could be a venv, TODO: parametrize)
shell = ['/bin/sh', '-c']

# add the corresponding process defined in project.yaml and append arguments from invoked command
args = cmd + args
args = shell + [' '.join(cmd + args)]
# print("trying to run process {} with args {}".format(cmd, args))
run_process(args=args, cwd=self.project_dir)

Expand Down