Commit 18f969c0 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

esrftaskgraph: passthrough dump arguments

parent b79c655e
......@@ -256,7 +256,9 @@ class TaskGraph:
add_subgraph_links(graph, edges, update_attrs)
self.graph = graph
def dump(self, destination=None, representation=GraphRepresentation.json_dict):
def dump(
self, destination=None, representation=GraphRepresentation.json_dict, **kw
"""From runtime to persistent representation"""
if isinstance(destination, str):
if destination.endswith(".json"):
......@@ -266,13 +268,13 @@ class TaskGraph:
elif representation == self.GraphRepresentation.json_file:
dictrepr = self.dump()
with open(destination, mode="w") as f:
json.dump(dictrepr, f, indent=2)
json.dump(dictrepr, f, **kw)
return destination
elif representation == self.GraphRepresentation.json_string:
dictrepr = self.dump()
return json.dumps(dictrepr)
return json.dumps(dictrepr, **kw)
elif representation == self.GraphRepresentation.yaml:
return networkx.readwrite.write_yaml(self.graph, destination)
return networkx.readwrite.write_yaml(self.graph, destination, **kw)
raise TypeError(representation, type(representation))
......@@ -18,5 +18,5 @@ names = [
for name in names:
graph, expected = getattr(taskgraphs, name)()
filename = os.path.join(outdir, name + ".json")
load_graph(graph).dump(filename, indent=2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment