-
Notifications
You must be signed in to change notification settings - Fork 100
2.4.2 ChRIS FS DS DS plugin worflow summary [moc]
This page provides summary instructions for directly interacting with the CUBE backend to create the following Feed workflow:
⬤:N N -- Indicates the instance id of the plugin
F|DS(K) K -- Indicates plugin id
⬤:1
|
| FS(18): pl-mri10yr06mo01da_normal_moc
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
↓ ↓ ↓
⬤:3 ⬤:4 ⬤:5 DS(15): pl-mpcs_moc
│ │ │
↓ ↓ ↓
⬤:6 ⬤:7 ⬤:8 DS(17): pl-z2labelmap_moc
#**************
# MOC *
#**************
oc login https://k-openshift.osh.massopen.cloud:8443 --token=MgakU9ennshIShEiVrvAskkQKVo41A9BvsITUZb68J4
oc get pods
oc logs --follow pfioh-XXXXX
oc logs --follow pman-XXXX
deljobs chris-jid-XXXX
oc logs --follow chris-jid-Y-XXX -c chris-jid-Y
oc get pvc
#**************
docker run -v $(pwd)/app:/app -p 8888:8888 jupyter/scipy-notebook
*destroy* ; sudo rm -fr CHRIS_REMOTE_FS; rm -fr CHRIS_REMOTE_FS; *make* -U -I -s -d -i local
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}' | head -n 1)
export HOST_PORT=8000
pfurl --verb POST --raw --http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse --jsonwrapper 'payload' --msg \
'{ "action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!",
"service": "host"
}
}' --quiet | underscore print --color
# RUN FS plugin BEFORE SETTING PROXY!!!
#######################################################################
# RUN FS plugin (plid:14) `pl-10yr06mo01da_normal` on host as (jid 0) #
#######################################################################
⬤:1
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/14/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/14/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[{"name":"dir",
"value":"/usr/src/data"}
]
}' --quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/1/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
#######################################################################
# Now set MOC and Proxy #
#######################################################################
pfurl --verb POST --raw \
--http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse \
--jsonwrapper 'payload' \
--msg \
'{ "action": "internalctl",
"meta": {
"var": "/service/moc",
"set": {
"compute": {
"addr": "pman-radiology.k-apps.osh.massopen.cloud",
"baseURLpath": "api/v1/cmd/",
"status": "undefined",
"authToken": "{Bu7H)FyWp{,e<"
},
"data": {
"addr": "pfioh-radiology.k-apps.osh.massopen.cloud",
"baseURLpath": "api/v1/cmd/",
"status": "undefined",
"authToken": "{Bu7H)FyWp{,e<",
"serviceMan": "openshift"
}
}
}
}' --quiet | underscore print --color
pfurl --verb POST --raw \
--http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse \
--jsonwrapper 'payload' \
--msg \
'{ "action": "internalctl",
"meta": {
"var": "/self",
"set": {
"httpProxy": {
"httpSpec": "http://proxy.tch.harvard.edu:3128",
"use": true
}
}
}
}' --quiet | underscore print --color
# Check on 'moc' settings
pfurl --verb POST --raw \
--http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse \
--jsonwrapper 'payload' \
--msg \
'{ "action": "internalctl",
"meta": {
"var": "/service",
"get": "value"
}
}' --quiet | underscore print --color
# Check on 'self' (proxy) settings
pfurl --verb POST --raw \
--http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse \
--jsonwrapper 'payload' \
--msg \
'{ "action": "internalctl",
"meta": {
"var": "/self",
"get": "value"
}
}' --quiet | underscore print --color
pfurl --verb POST --raw --http ${HOST_IP}:5005/api/v1/cmd \
--httpResponseBodyParse --jsonwrapper 'payload' --msg \
'{ "action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!",
"service": "moc"
}
}' --quiet | underscore print --color
##############################################################################
# RUN DS plugin (plid:16) `pl-freesurfer_pp_moc` on MOC (pvid:1) as (jid:2) #
##############################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/16/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/16/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"ageSpec",
"value":"10-06-01"},
{"name":"copySpec",
"value":"stats,sag,cor,tra,3D"},
{"name":"previous_id",
"value":"1"}
]
}' --quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/2/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
####################################################################
# RUN DS plugin (plid:15) `pl-mpcs_moc` on MOC (pvid:2) as (jid:3) #
####################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱
╱
╱
╱
╱
↓
⬤:3 DS(15): pl-mpcs_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/instances/. \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' --quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/3/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
####################################################################
# RUN DS plugin (plid:15) `pl-mpcs_moc` on MOC (pvid:2) as (jid:4) #
####################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│
╱ │
╱ │
╱ │
╱ │
↓ ↓
⬤:3 ⬤:4 DS(15): pl-mpcs_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/instances/. \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' --quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/4/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
####################################################################
# RUN DS plugin (plid:15) `pl-mpcs_moc` on MOC (pvid:2) as (jid:5) #
####################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
↓ ↓ ↓
⬤:3 ⬤:4 ⬤:5 DS(15): pl-mpcs_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/15/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' --quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/5/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
##########################################################################
# RUN DS plugin (plid:17) `pl-z2labelmap_moc` on MOC (pvid:3) as (jid 6) #
##########################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
↓ ↓ ↓
⬤:3 ⬤:4 ⬤:5 DS(15): pl-mpcs_moc
│
↓
⬤:6 DS(17): pl-z2labelmap_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"3"}
]
}' \
--quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/6/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
##########################################################################
# RUN DS plugin (plid:17) `pl-z2labelmap_moc` on MOC (pvid:4) as (jid 7) #
##########################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
↓ ↓ ↓
⬤:3 ⬤:4 ⬤:5 DS(15): pl-mpcs_moc
│ │
↓ ↓
⬤:6 ⬤:7 DS(17): pl-z2labelmap_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"4"}
]
}' \
--quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/7/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
##########################################################################
# RUN DS plugin (plid:17) `pl-z2labelmap_moc` on MOC (pvid:5) as (jid 8) #
##########################################################################
⬤:1
|
| FS(14): pl-mri10yr06mo01da_normal
↓
⬤:2 DS(16): pl-freesurfer_pp_moc
╱│╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
╱ │ ╲
↓ ↓ ↓
⬤:3 ⬤:4 ⬤:5 DS(15): pl-mpcs_moc
│ │ │
↓ ↓ ↓
⬤:6 ⬤:7 ⬤:8 DS(17): pl-z2labelmap_moc
pfurl --auth chris:chris1234 --verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4 | underscore print --color
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/17/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"5"}
]
}' \
--quiet | underscore print --color
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/8/ \
--content-type application/vnd.collection+json --quiet \
--jsonpprintindent 4 | underscore print --color
The set of operations are:
- instantiate CUBE;
- if using
pl-mri10yr06mo01da_normal
then simply run the plugin; - if using
pl-pacscopy
then after instantiation:- clear the internal
pman
job-IDjid
database; - pull a sample dataset from github;
- push into openstorage
- the the
pl-pacscopy
plugin
- clear the internal
- if using
- run the FS data through
pl-freesurfer_pp
to create a FreeSurfer output (pre calculated on the FS output) - run the FreeSurfer output through three parallel
pl-mpcs
plugins, each generating a different output - run each of the 3 outputs through a
pl-z2labelmap
to create one of three sets of heat maps.
Make sure you are in the base directory of the ChRIS_ultron_backEnd (CUBE) repo:
git clone https://github.com/FNNDSC/ChRIS_ultron_backEnd
cd ChRIS_ultron_backEnd
*destroy* ; sudo rm -fr CHRIS_REMOTE_FS; rm -fr CHRIS_REMOTE_FS ; *make* -U -I -s
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
export HOST_PORT=8000
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/18/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[{"name":"dir",
"value":"/usr/src/data"}
]
}' \
--quiet --jsonpprintindent 4
Query the status of the plugin job:
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/1/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
CLI equivalent
mkdir in out && chmod 777 out
docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-freesurfer_pp freesurfer_pp.py \
-a 10-06-01 \
-c stats,sag,cor,tra,3D \
/incoming /outgoing
In the context of CUBE,
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/12/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"ageSpec",
"value":"10-06-01"},
{"name":"copySpec",
"value":"stats,sag,cor,tra,3D"},
{"name":"previous_id",
"value":"1"}
]
}' \
--quiet --jsonpprintindent 4
NOTE: Please be patient with this plugin. Due to the high volume of data, it can take several minutes to complete.
Query the results of the plugin call:
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/2/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
The equivalent CLI call for the plugin would be
mkdir in out && chmod 777 out
docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-mpcs mpcs.py \
--random --seed 1 \
--posRange 3.0 --negRange -3.0 \
in out
which in the context of CUBE becomes
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/11/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' \
--quiet --jsonpprintindent 4
and query the status of the call with
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/3/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
This call can take some time to complete, mostly due to data transfers.
Repeat the plugin call two more times. Test the status of each with
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/11/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/4/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/11/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"random",
"value":true},
{"name":"seed",
"value":"1"},
{"name":"posRange",
"value":"3.0"},
{"name":"negRange",
"value":"-3.0"},
{"name":"previous_id",
"value":"2"}
]
}' \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/5/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
Now, finally, we will run the pl-z2labelmap
on each branch of the pl-mpc
output. The equivalent CLI call is
docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-z2labelmap z2labelmap.py \
--scaleRange 2.0 --lowerFilter 0.8 \
--negColor B --posColor R \
/incoming /outgoing
Which, in each branch becomes:
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/13/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"3"}
]
}' \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/6/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/13/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"4"}
]
}' \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/7/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 --verb POST \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/13/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
[
{"name":"imageSet",
"value":"../data/set1"},
{"name":"negColor",
"value":"B"},
{"name":"posColor",
"value":"R"},
{"name":"previous_id",
"value":"5"}
]
}' \
--quiet --jsonpprintindent 4
pfurl --auth chris:chris1234 \
--verb GET \
--http ${HOST_IP}:${HOST_PORT}/api/v1/plugins/instances/8/ \
--content-type application/vnd.collection+json \
--quiet --jsonpprintindent 4
-30-