Skip to content

Commit

Permalink
replace Component with PythonApp, which defaults to SleepApp
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwuperth committed Jun 21, 2017
1 parent 9874a77 commit 6a1c067
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
32 changes: 20 additions & 12 deletions dfms/dropmake/pg_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,18 @@ def make_oid(self, iid=0):
"""
return "{0}_{1}_{2}".format(self._ssid, self.id, iid)

def _update_key_value_attributes(self, kwargs):
for i in range(10):
k = "Arg%02d" % (i + 1,)
if not k in self.jd:
continue
v = self.jd[k]
if (v is not None and len(str(v)) > 0):
for kv in v.split(","): # comma separated k-v pairs
k_v = kv.replace(' ', '').split("=")
if (len(k_v) > 1):
kwargs[k_v[0]] = k_v[1]

def _create_test_drop_spec(self, oid, kwargs):
"""
TODO
Expand Down Expand Up @@ -522,31 +534,27 @@ def _create_test_drop_spec(self, oid, kwargs):
if (fp):
kwargs['filepath'] = fp
elif (drop_type == 'Component'): # default generic component becomes "sleep and copy"
dropSpec = dropdict({'oid':oid, 'type':'app', 'app':'test.graphsRepository.SleepApp'})
if 'execution_time' in self.jd:
sleepTime = int(self.jd['execution_time'])
else:
sleepTime = random.randint(3, 8)
kwargs['tw'] = sleepTime
kwargs['sleepTime'] = sleepTime
if ('appclass' not in self.jd or len(self.jd['appclass']) == 0):
app_class = 'test.graphsRepository.SleepApp'
kwargs['sleepTime'] = sleepTime
else:
app_class = self.jd['appclass']
dropSpec = dropdict({'oid':oid, 'type':'app', 'app':app_class})
kwargs['num_cpus'] = int(self.jd.get('num_cpus', 1))
self._update_key_value_attributes(kwargs)
dropSpec.update(kwargs)
elif (drop_type == 'DynlibApp'):
if ('libpath' not in self.jd or len(self.jd['libpath']) == 0):
raise GraphException("Missing 'libpath' in Drop {0}".format(self.text))
dropSpec = dropdict({'oid':oid, 'type':'app', 'app':'dfms.apps.dynlib.DynlibApp'})
kwargs['lib'] = self.jd['libpath']
kwargs['tw'] = int(self.jd['execution_time'])
for i in range(10):
k = "Arg%02d" % (i + 1,)
if not k in self.jd:
continue
v = self.jd[k]
if (v is not None and len(str(v)) > 0):
for kv in v.split(","): # comma separated k-v pairs
k_v = kv.replace(' ', '').split("=")
if (len(k_v) > 1):
kwargs[k_v[0]] = k_v[1]
self._update_key_value_attributes(kwargs)

dropSpec.update(kwargs)
elif (drop_type in ['BashShellApp', 'mpi']):
Expand Down
4 changes: 2 additions & 2 deletions dfms/dropmake/web/lg_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,8 @@
nodeDataArray:[// specify the contents of the Palette
{ category: "Start", text: "Start" },
{ category: "End", text: "End" },
{ category: "Component", text: "Component", execution_time: 5,
num_cpus: 1, group_start: 0,
{ category: "Component", text: "PythonApp", execution_time: 5,
num_cpus: 1, group_start: 0, appclass: "test.graphsRepository.SleepApp",
Arg01: "", Arg02: "", Arg03: "", Arg04: "", Arg05: "",
Arg06: "", Arg07: "", Arg08: "", Arg09: "", Arg10: ""},
{ category: "BashShellApp", text: "ShellApp", execution_time: 5,
Expand Down

0 comments on commit 6a1c067

Please sign in to comment.