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
b18f761b
Commit
b18f761b
authored
7 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
Initial reworking of run endpoint
parent
1789f634
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
api/jobs/handlers.py
+25
-7
25 additions, 7 deletions
api/jobs/handlers.py
with
25 additions
and
7 deletions
api/jobs/handlers.py
+
25
−
7
View file @
b18f761b
...
...
@@ -546,29 +546,47 @@ class BatchHandler(base.RequestHandler):
self
.
abort
(
400
,
'
targets must all be of same type.
'
)
container_ids
.
append
(
t
.
get
(
'
id
'
))
# Get acquisitions associated with targets
objectIds
=
[
bson
.
ObjectId
(
x
)
for
x
in
container_ids
]
containers
=
AcquisitionStorage
().
get_all_for_targets
(
container_type
,
objectIds
,
collection_id
=
collection_id
,
include_archived
=
False
)
# Determine if gear is no-input gear
file_inputs
=
False
for
input_
in
gear
[
'
gear
'
].
get
(
'
inputs
'
,
{}).
itervalues
():
if
input_
[
'
base
'
]
==
'
file
'
:
file_inputs
=
True
break
if
not
file_inputs
:
# Grab sessions rather than acquisitions
containers
=
SessionStorage
().
get_all_for_targets
(
container_type
,
objectIds
,
collection_id
=
collection_id
,
include_archived
=
False
)
else
:
# Get acquisitions associated with targets
containers
=
AcquisitionStorage
().
get_all_for_targets
(
container_type
,
objectIds
,
collection_id
=
collection_id
,
include_archived
=
False
)
if
not
containers
:
self
.
abort
(
404
,
'
Could not find acquisitions from targets.
'
)
improper_permissions
=
[]
acquisiti
ons
=
[]
perm_checked_c
on
t
s
=
[]
# Make sure user has read-write access, add those to acquisition list
for
c
in
containers
:
if
self
.
superuser_request
or
has_access
(
self
.
uid
,
c
,
'
rw
'
):
c
.
pop
(
'
permissions
'
)
acquisiti
ons
.
append
(
c
)
perm_checked_c
on
t
s
.
append
(
c
)
else
:
improper_permissions
.
append
(
c
[
'
_id
'
])
if
not
acquisiti
ons
:
if
not
perm_checked_c
on
t
s
:
self
.
abort
(
403
,
'
User does not have write access to targets.
'
)
results
=
batch
.
find_matching_conts
(
gear
,
acquisitions
,
'
acquisition
'
)
if
not
file_inputs
:
else
:
# Look for file matches in each acquisition
results
=
batch
.
find_matching_conts
(
gear
,
perm_checked_conts
,
'
acquisition
'
)
matched
=
results
[
'
matched
'
]
batch_proposal
=
{}
...
...
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