Skip to content

Commit

Permalink
Wrapping dispatcher commands in a shell (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Capuccini authored May 23, 2022
1 parent 76580e4 commit 4b53136
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 4b53136

Please sign in to comment.