Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
c6299abf
Commit
c6299abf
authored
10 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
start adding specs of jobs's possible outputs
parent
ff12d56c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util.py
+31
-19
31 additions, 19 deletions
util.py
with
31 additions
and
19 deletions
util.py
+
31
−
19
View file @
c6299abf
...
...
@@ -152,19 +152,33 @@ def create_job(dbc, dataset):
kinds_
=
dataset
.
nims_file_kinds
state_
=
dataset
.
nims_file_state
app_id
=
None
output_state
=
None
output_type
=
None
output_kinds
=
None
if
type_
==
'
dicom
'
and
state_
==
[
'
orig
'
]:
if
kinds_
!=
[
'
screenshot
'
]:
# could ship a script that gets mounted into the container.
# but then the script would also need to specify what base image it needs.
app_id
=
'
scitran/dcm2nii:latest
'
output_state
=
[
'
derived
'
,
]
output_type
=
'
nifti
'
output_kinds
=
dataset
.
nims_file_kinds
# from input file
# TODO: determine job specifications
# app_input is implied; type = 'dicom', state =['orig',] and kinds != 'screenshot'
app_outputs
=
[
{
'
fext
'
:
'
.nii.gz
'
,
'
state
'
:
[
'
derived
'
,
],
'
type
'
:
'
nifti
'
,
'
kinds
'
:
dataset
.
nims_file_kinds
,
# there should be someway to indicate 'from parent file'
},
{
'
fext
'
:
'
.bvec
'
,
'
state
'
:
[
'
derived
'
,
],
'
type
'
:
'
text
'
,
'
kinds
'
:
[
'
bvec
'
,
],
},
{
'
fext
'
:
'
.bval
'
,
'
state
'
:
[
'
derived
'
,
],
'
type
'
:
'
text
'
,
'
kinds
'
:
[
'
bval
'
,
],
},
]
# force acquisition dicom file to be marked as 'optional = True'
db
.
acquisitions
.
find_and_modify
(
...
...
@@ -181,6 +195,7 @@ def create_job(dbc, dataset):
project
=
db
.
projects
.
find_one
({
'
_id
'
:
bson
.
ObjectId
(
session
.
get
(
'
project
'
))})
aid
=
acquisition
.
get
(
'
_id
'
)
# TODO: job description needs more metadata to be searchable in a useful way
output_url
=
'
%s/%s/%s
'
%
(
'
acquisitions
'
,
aid
,
'
file
'
)
job
=
db
.
jobs
.
find_and_modify
(
{
'
_id
'
:
db
.
jobs
.
count
()
+
1
,
...
...
@@ -188,9 +203,15 @@ def create_job(dbc, dataset):
{
'
_id
'
:
db
.
jobs
.
count
()
+
1
,
'
group
'
:
project
.
get
(
'
group_id
'
),
'
project
'
:
project
.
get
(
'
_id
'
),
'
project
'
:
{
'
_id
'
:
project
.
get
(
'
_id
'
),
'
name
'
:
project
.
get
(
'
name
'
),
},
'
exam
'
:
session
.
get
(
'
exam
'
),
'
app_id
'
:
app_id
,
'
app
'
:
{
'
_id
'
:
app_id
,
'
type
'
:
'
docker
'
,
},
'
inputs
'
:
[
{
'
url
'
:
'
%s/%s/%s
'
%
(
'
acquisitions
'
,
aid
,
'
file
'
),
...
...
@@ -201,16 +222,7 @@ def create_job(dbc, dataset):
},
}
],
'
outputs
'
:
[
{
'
url
'
:
'
%s/%s/%s
'
%
(
'
acquisitions
'
,
aid
,
'
file
'
),
'
payload
'
:
{
'
type
'
:
output_type
,
'
state
'
:
output_state
,
# TODO defined in app
'
kinds
'
:
output_kinds
,
},
},
],
'
outputs
'
:
[{
'
url
'
:
output_url
,
'
payload
'
:
i
}
for
i
in
app_outputs
],
'
status
'
:
'
pending
'
,
# queued
'
activity
'
:
None
,
'
added
'
:
datetime
.
datetime
.
now
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment