Skip to content

Commit

Permalink
Fixed small issues with existing graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed May 7, 2023
1 parent bd322a3 commit ef6e53a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions daliuge-engine/dlg/graph_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ def _getKwargs(dropSpec):
"uid",
"Application",
"dropclass",
"appclass",
"dataclass",
"data",
"Data",
]
Expand Down
26 changes: 21 additions & 5 deletions daliuge-translator/dlg/dropmake/lg_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,27 @@ def _create_listener_drops(self, drop_spec):
def _create_app_drop(self, drop_spec):
# default generic component becomes "sleep and copy"
if "appclass" in self.jd:
self.dropclass = self.jd["appclass"]
app_class = self.dropclass
logger.debug("Creating app drop using class: %s", self.dropclass)
if self.dropclass is None or self.dropclass == "":
app_class = self.jd["appclass"]
elif self.dropclass is None or self.dropclass == "":
logger.debug("No dropclass found in: %s", self)
app_class = "dlg.apps.simple.SleepApp"
else:
app_class = self.dropclass
execTime = self.weight
if self.dropclass == "dlg.apps.simple.SleepApp":
if self.category == "BashShellApp":
app_class = "dlg.apps.bash_shell_app.BashShellApp"
elif self.category == "Docker":
app_class = "dlg.apps.dockerapp.DockerApp"
else:
logger.debug("Might be a problem with this node: %s", self.jd)

self.dropclass = app_class
execTime = self.weight
self.jd["dropclass"] = app_class
self.dropclass = app_class
logger.debug("Creating app drop using class: %s", app_class)
if self.dropclass is None or self.dropclass == "":
logger.warning(f"Something wrong with this node: {self.jd}")
if self.weight is not None:
execTime = self.weight
if execTime < 0:
Expand Down Expand Up @@ -1001,6 +1013,8 @@ def _create_data_drop(self, drop_spec):
self.dropclass = "dlg.data.drops.file.FileDROP"
elif self.category == "Memory":
self.dropclass = "dlg.data.drops.memory.InMemoryDROP"
elif self.category == "SharedMemory":
self.dropclass = "dlg.data.drops.memory.SharedMemoryDROP"
else:
raise TypeError("Unknown data class for drop: %s", self.jd)
logger.debug("Creating data drop using class: %s", self.dropclass)
Expand Down Expand Up @@ -1047,6 +1061,8 @@ def make_single_drop(self, iid="0", **kwargs):
drop_spec = self._create_gather_drops(drop_spec)
elif self.is_service or self.is_branch:
kwargs["categoryType"] = "Application"
self.jd["categoryType"] = "Application"
drop_spec = self._create_app_drop(drop_spec)
kwargs["iid"] = iid
kwargs["lg_key"] = self.id
if self.is_branch:
Expand Down
8 changes: 6 additions & 2 deletions daliuge-translator/dlg/dropmake/pgtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ def _parse_metis_output(self, metis_out, jsobj):
group_weight[gid] = [0, 0]
for gnode in G.nodes(data=True):
tt = group_weight[gnode[1]["gid"]]
tt[0] += gnode[1]["weight"]
tt[1] += gnode[1]["size"]
try:
tt[0] += int(gnode[1]["weight"])
tt[1] += int(gnode[1]["size"])
except ValueError:
tt[0] = 1
tt[1] = 1
# the following is for visualisation using GOJS
if jsobj is not None:
node_list = jsobj["nodeDataArray"]
Expand Down

0 comments on commit ef6e53a

Please sign in to comment.