diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2019-11-17 09:16:57 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2019-11-17 09:16:57 +0100 |
commit | 3d93df54d024f49895db6277e873dccd10b5baec (patch) | |
tree | c664797c69e4b4680d04aee7669da03e452e0c5d /tests/roof.py | |
download | ufo-roof-temp-3d93df54d024f49895db6277e873dccd10b5baec.tar.gz ufo-roof-temp-3d93df54d024f49895db6277e873dccd10b5baec.tar.bz2 ufo-roof-temp-3d93df54d024f49895db6277e873dccd10b5baec.tar.xz ufo-roof-temp-3d93df54d024f49895db6277e873dccd10b5baec.zip |
The first test (file file-base simmulation)
Diffstat (limited to 'tests/roof.py')
-rw-r--r-- | tests/roof.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/roof.py b/tests/roof.py new file mode 100644 index 0000000..2138931 --- /dev/null +++ b/tests/roof.py @@ -0,0 +1,46 @@ +import gi +import sys +import json +import gobject + +from gi.repository import Ufo +from gi.repository import GObject + +class RoofConfig: + def __init__(self, config="roof.json"): + self.streams = 1 + + with open(config) as json_file: + cfg = json.load(json_file) + if cfg.get("network", {}).get("streams") != None: + self.streams = cfg["network"]["streams"] + elif cfg.get("setup", {}).get("modules") != None: + self.streams = cfg["setup"]["modules"] + +config = "roof.json" +cfg = RoofConfig(config) + +pm = Ufo.PluginManager() +graph = Ufo.TaskGraph() +scheduler = Ufo.Scheduler() + + +build = pm.get_task('roof-build') +build.set_properties(config=config, number=0) + +write = pm.get_task('write') +write.set_properties(filename="test.raw") + +for id in range(cfg.streams): + read = pm.get_task('roof-read') + read.set_properties(config=config, id=id) + graph.connect_nodes(read, build) + build.bind_property('stop', read, 'stop', GObject.BindingFlags.DEFAULT) + +#read_task.set_properties(path='/home/data/*.tif', start=10, number=100) +#graph.connect_nodes_full(read, write, 0) +graph.connect_nodes(build, write) + + + +scheduler.run(graph) |