Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Wout De Nolf
dahu-demo
Commits
55c52ba7
Commit
55c52ba7
authored
Mar 06, 2022
by
Wout De Nolf
Browse files
prepare demo
parent
1041c089
Pipeline
#68726
failed with stages
in 3 minutes and 47 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dahu_demo/plugins/math.py
0 → 100644
View file @
55c52ba7
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"
]
dahu_demo/plugins/workflow.py
View file @
55c52ba7
...
...
@@ -9,5 +9,6 @@ class ExecuteGraph(Plugin):
kwargs
=
{
k
:
v
for
k
,
v
in
self
.
input
.
items
()
if
k
not
in
(
"job_id"
,
"plugin_name"
)
}
kwargs
[
"execinfo"
]
=
{
"job_id"
:
self
.
input
.
job_id
}
execute_graph
(
**
kwargs
)
# self.output["result"] = ...
demo/install.sh
View file @
55c52ba7
...
...
@@ -12,7 +12,7 @@ function main {
# install dahu
local
dahu_source
=
$HOME
/dev/dahu
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
python
-m
pip
install
-e
$SCRIPT_ROOT
/..
...
...
demo/requirements-conda.txt
View file @
55c52ba7
python=3.8
pytango
numpy
# dev:
black
flake8
pytest
\ No newline at end of file
demo/run.py
View file @
55c52ba7
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
}
plugin
=
"math.addnumbers"
kwargs
=
{
"a"
:
1
,
"b"
:
2
}
proxy
=
DeviceProxy
(
"tango://localhost:10000/id00/dahu/1"
)
pid
=
proxy
.
startJob
([
plugin
,
json
.
dumps
(
kwargs
)])
...
...
demo/run.sh
0 → 100755
View file @
55c52ba7
#!/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
demo/run_workflow.py
0 → 100644
View file @
55c52ba7
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
))
demo/start_dahu.sh
View file @
55c52ba7
#!/bin/bash
export
TANGO_HOST
=
localhost:10000
export
DAHU_PLUGINS
=
$(
python
-c
"from dahu_demo import plugins;print(plugins.__path__[0])"
)
dahu-register
--instance
dahu
dahu-server dahu
-v3
SCRIPT_ROOT
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
source
${
SCRIPT_ROOT
}
/utils.sh
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment