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
3effe5c9
Commit
3effe5c9
authored
Mar 06, 2022
by
Wout De Nolf
Browse files
prepare demo
parent
1041c089
Pipeline
#68729
passed with stages
in 3 minutes and 38 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
3effe5c9
...
@@ -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/
woutdenol
f/dahu.git
@server_entry_point
-
python -m pip install git+https://github.com/
ki
f/dahu.git
-
pip install --pre .[test]
-
pip install --pre .[test]
-
pytest --pyargs dahu
-
pytest --pyargs dahu
-
pytest -v
-
pytest -v
dahu_demo/plugins/math.py
0 → 100644
View file @
3effe5c9
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 @
3effe5c9
...
@@ -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"] = ...
demo/install.sh
View file @
3effe5c9
...
@@ -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
/..
...
...
demo/requirements-conda.txt
View file @
3effe5c9
python=3.8
python=3.8
pytango
pytango
numpy
numpy
# dev:
black
flake8
pytest
\ No newline at end of file
demo/run.py
View file @
3effe5c9
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
)])
...
...
demo/run.sh
0 → 100755
View file @
3effe5c9
#!/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 @
3effe5c9
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 @
3effe5c9
#!/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
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