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
7970eea7
Commit
7970eea7
authored
9 years ago
by
Nathaniel Kofalt
Browse files
Options
Downloads
Patches
Plain Diff
Add spawn_jobs to handle files -> queued jobs decision logic
parent
b9ad3d2c
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
jobs.py
+35
-0
35 additions, 0 deletions
jobs.py
with
35 additions
and
0 deletions
jobs.py
+
35
−
0
View file @
7970eea7
...
...
@@ -44,6 +44,41 @@ ALGORITHMS = [
# TODO: json schema
def
spawn_jobs
(
db
,
containers
,
file
):
"""
Spawn some number of queued jobs to process a file.
Parameters
----------
db: pymongo.database.Database
Reference to the database instance
containers: [ tuple(string, scitran.Container) ]
An array of tuples, each containing a container type name, and a container object.
Contract is:
1) The first container in the array will be the container which owns file passed in the file param.
2) Following array indexes, if any, will be higher in the ownership heirarchy than the first container.
3) Array is not guaranteed to be strictly hierarchically ordered.
file: scitran.File
File object that is used to spawn 0 or more jobs.
"""
# File information
filename
=
file
[
'
filename
'
]
filehash
=
file
[
'
filehash
'
]
# File container information
last
=
len
(
containers
)
-
1
container_type
,
container
=
containers
[
last
]
container_id
=
container
[
'
_id
'
]
log
.
info
(
'
File
'
+
filename
+
'
is in a
'
+
container_type
+
'
with id
'
+
str
(
container_id
)
+
'
and hash
'
+
filehash
)
# Spawn rules currently do not look at container hierarchy, and only care about a single file.
# Further, one algorithm is unconditionally triggered for each dirty file.
queue_job
(
db
,
'
dcm2nii
'
,
container_type
,
container_id
,
filename
,
filehash
)
def
queue_job
(
db
,
algorithm_id
,
container_type
,
container_id
,
filename
,
filehash
,
attempt_n
=
1
,
previous_job_id
=
None
):
"""
Enqueues a job for execution.
...
...
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