radical-cybertools / radical.pilot

RADICAL-Pilot
http://radical-cybertools.github.io/radical-pilot/index.html
Other
54 stars 23 forks source link

stress-ng can't read the arguments from rp compute unit #1586

Closed georgeha closed 6 years ago

georgeha commented 6 years ago

If I define the arguments of stress-ng as CU arguments. Stress-ng does not read the arguments.

It works

       cud = rp.ComputeUnitDescription()
       cud.executable       = 'stress-ng --cpu 1  --timeout 720s'
      #cud.arguments = [' ']    
      cud.cores = 1

it does not work

       cud = rp.ComputeUnitDescription()
       cud.executable       = 'stress-ng '
      cud.arguments = [' --cpu 1 --timeout 720s ']    # 720 sec = 12 min
      cud.cores = 1
georgeha commented 6 years ago

My assumption is that rp add "" to the arguments. The unit.0000.sh has:

stress-ng " --cpu 1 --timeout 720s "

and stress-ng can't read the arguments

andre-merzky commented 6 years ago

arguments is a list, and that's for a good reason :-) This should work:

cud.arguments = ['--cpu', '1', '--timeout', '720s']    # 720 sec = 12 min

as should this:

cud.arguments = '--cpu 1 --timeout 720s '.split()    # 720 sec = 12 min

The reason for this is the handling of arguments which do contain spaces - quoting gets tricky then. Assume the command line:

$ grep "foo 'bar' buz" /dev/random

The current array based syntax makes this easy:

cud.arguments = ["foo 'bar' buz", "/dev/random"]

It might be a corner case - but quotes and spaces in arguments are frequent enough to matter. Hell, we had users which pass whole python scripts (50 lines or so) as command line arguments! :-P

andre-merzky commented 6 years ago

PS.; the fact that specifying all off it for cud.executable is coincidental (i.e. lucky), and depends on the launch method used in the pilot. You cannot in general rely on this.

andre-merzky commented 6 years ago

@georgeha : ping - is this resolved?

georgeha commented 6 years ago

yes. Closing now