Commit 3effe5c9 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

prepare demo

parent 1041c089
Pipeline #68729 passed with stages
in 3 minutes and 38 seconds
...@@ -26,7 +26,7 @@ test: ...@@ -26,7 +26,7 @@ test:
- conda config --env --add channels tango-controls - conda config --env --add channels tango-controls
- conda install --file demo/requirements-conda.txt - conda install --file demo/requirements-conda.txt
- conda install pytest - conda install pytest
- python -m pip install git+https://github.com/woutdenolf/dahu.git@server_entry_point - python -m pip install git+https://github.com/kif/dahu.git
- pip install --pre .[test] - pip install --pre .[test]
- pytest --pyargs dahu - pytest --pyargs dahu
- pytest -v - pytest -v
from dahu.plugin import Plugin
from dahu.factory import register
@register
class AddNumbers(Plugin):
def process(self):
self.output["sum"] = self.input["a"] + self.input["b"]
...@@ -6,8 +6,10 @@ from ewoks import execute_graph ...@@ -6,8 +6,10 @@ from ewoks import execute_graph
@register @register
class ExecuteGraph(Plugin): class ExecuteGraph(Plugin):
def process(self): def process(self):
kwargs = { kwargs = dict(self.input)
k: v for k, v in self.input.items() if k not in ("job_id", "plugin_name") kwargs.pop("plugin_name")
} kwargs.pop("job_id")
# job_id = kwargs.pop("job_id")
# kwargs["execinfo"] = {"job_id": job_id}
execute_graph(**kwargs) execute_graph(**kwargs)
# self.output["result"] = ... # self.output["result"] = ...
...@@ -12,7 +12,7 @@ function main { ...@@ -12,7 +12,7 @@ function main {
# install dahu # install dahu
local dahu_source=$HOME/dev/dahu local dahu_source=$HOME/dev/dahu
find $dahu_source| grep -E "(__pycache__|\.pyc|\.pyo|\.egg-info$)" | xargs rm -rf find $dahu_source| grep -E "(__pycache__|\.pyc|\.pyo|\.egg-info$)" | xargs rm -rf
python -m pip install -e $dahu_source python -m pip install $dahu_source # NO DEV INSTALLATION!
# install the demo project # install the demo project
python -m pip install -e $SCRIPT_ROOT/.. python -m pip install -e $SCRIPT_ROOT/..
......
python=3.8 python=3.8
pytango pytango
numpy numpy
# dev:
black
flake8
pytest
\ No newline at end of file
import json import json
from time import sleep from time import sleep
from tango import DeviceProxy from tango import DeviceProxy
from ewokscore.tests.examples.graphs import get_graph
plugin = "math.addnumbers"
plugin = "workflow.executegraph" kwargs = {"a": 1, "b": 2}
workflow, _ = get_graph("acyclic1")
varinfo = {"root_uri": "results"}
kwargs = {"graph": workflow, "binding": None, "varinfo": varinfo}
proxy = DeviceProxy("tango://localhost:10000/id00/dahu/1") proxy = DeviceProxy("tango://localhost:10000/id00/dahu/1")
pid = proxy.startJob([plugin, json.dumps(kwargs)]) pid = proxy.startJob([plugin, json.dumps(kwargs)])
......
#!/bin/bash
SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${SCRIPT_ROOT}/utils.sh
function main {
source $(conda_root)/bin/activate $(conda_env)
python ${SCRIPT_ROOT}/run.py
}
main
\ No newline at end of file
import json
from time import sleep
from tango import DeviceProxy
from ewokscore.tests.examples.graphs import get_graph
plugin = "workflow.executegraph"
workflow, _ = get_graph("acyclic1")
varinfo = {"root_uri": "results"}
kwargs = {"graph": workflow, "binding": None, "varinfo": varinfo}
proxy = DeviceProxy("tango://localhost:10000/id00/dahu/1")
pid = proxy.startJob([plugin, json.dumps(kwargs)])
while proxy.getJobState(pid) == "starting":
sleep(0.01)
proxy.waitJob(pid)
print("Output: %s" % proxy.getJobOutput(pid))
#!/bin/bash #!/bin/bash
export TANGO_HOST=localhost:10000 SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export DAHU_PLUGINS=$(python -c "from dahu_demo import plugins;print(plugins.__path__[0])") source ${SCRIPT_ROOT}/utils.sh
dahu-register --instance dahu
dahu-server dahu -v3 function main {
source $(conda_root)/bin/activate $(conda_env)
export TANGO_HOST=localhost:10000
export DAHU_PLUGINS=$(python -c "from dahu_demo import plugins;print(plugins.__path__[0])")
dahu-register --instance dahu --member 1
dahu-server dahu -v3
}
main
\ No newline at end of file
Supports Markdown
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