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
063ee2fe
Commit
063ee2fe
authored
10 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
move job creation to happen after file insertion
parent
6411764e
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
+11
-2
11 additions, 2 deletions
util.py
with
11 additions
and
2 deletions
util.py
+
11
−
2
View file @
063ee2fe
...
...
@@ -68,6 +68,7 @@ def insert_file(dbc, _id, file_info, filepath, digest, data_path, quarantine_pat
if
not
success
[
'
updatedExisting
'
]:
dbc
.
update
({
'
_id
'
:
_id
},
{
'
$push
'
:
{
flavor
:
file_info
}})
shutil
.
move
(
filepath
,
container_path
+
'
/
'
+
filename
)
create_job
(
dbc
,
dataset
)
log
.
debug
(
'
Done %s
'
%
os
.
path
.
basename
(
filepath
))
# must use filepath, since filename is updated for sorted files
return
200
,
'
Success
'
...
...
@@ -125,10 +126,9 @@ def _update_db(db, dataset):
db
.
projects
.
update
({
'
_id
'
:
project
[
'
_id
'
]},
{
'
$max
'
:
dict
(
timestamp
=
dataset
.
nims_timestamp
)})
db
.
sessions
.
update
({
'
_id
'
:
session
[
'
_id
'
]},
{
'
$min
'
:
dict
(
timestamp
=
dataset
.
nims_timestamp
),
'
$set
'
:
dict
(
timezone
=
dataset
.
nims_timezone
)})
# create a job, if necessary
create_job
(
db
,
dataset
)
return
acquisition
[
'
_id
'
]
def
create_job
(
db
,
dataset
):
def
create_job
(
db
c
,
dataset
):
# TODO: this should search the 'apps' db collection.
# each 'app' must define it's expected inputs's type, state and kind
# some apps are special defaults. one default per data specific triple.
...
...
@@ -143,6 +143,9 @@ def create_job(db, dataset):
# 'state_': fstate[-1], # string
# })
# apps specify the last state of their desired input file.
db
=
dbc
.
database
type_
=
dataset
.
nims_file_type
kinds_
=
dataset
.
nims_file_kinds
state_
=
dataset
.
nims_file_state
...
...
@@ -161,6 +164,12 @@ def create_job(db, dataset):
output_kinds
=
dataset
.
nims_file_kinds
# from input file
# TODO: determine job specifications
# force acquisition dicom file to be marked as 'optional = True'
db
.
acquisitions
.
find_and_modify
(
{
'
uid
'
:
dataset
.
nims_acquisition_id
,
'
files.type
'
:
'
dicom
'
},
{
'
$set
'
:
{
'
files.$.optional
'
:
True
}},
)
if
not
app_id
:
log
.
info
(
'
no app for type=%s, state=%s, kinds=%s, default=True. no job created.
'
%
(
type_
,
state_
,
kinds_
))
else
:
...
...
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