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
b9667590
Commit
b9667590
authored
8 years ago
by
Nathaniel Kofalt
Committed by
Megan Henning
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add route docs
parent
842676ab
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/jobs/handlers.py
+28
-2
28 additions, 2 deletions
api/jobs/handlers.py
api/jobs/jobs.py
+3
-3
3 additions, 3 deletions
api/jobs/jobs.py
with
31 additions
and
5 deletions
api/jobs/handlers.py
+
28
−
2
View file @
b9667590
...
...
@@ -341,7 +341,7 @@ class JobsHandler(base.RequestHandler):
# Add job tags, config, attempt number, and/or previous job ID, if present
tags
=
submit
.
get
(
'
tags
'
,
None
)
config
=
submit
.
get
(
'
config
'
,
None
)
config
_
=
submit
.
get
(
'
config
'
,
None
)
attempt_n
=
submit
.
get
(
'
attempt_n
'
,
1
)
previous_job_id
=
submit
.
get
(
'
previous_job_id
'
,
None
)
...
...
@@ -359,7 +359,7 @@ class JobsHandler(base.RequestHandler):
inputs
[
x
].
check_access
(
self
.
uid
,
'
ro
'
)
destination
.
check_access
(
self
.
uid
,
'
rw
'
)
job
=
Job
(
gear_name
,
inputs
,
destination
=
destination
,
tags
=
tags
,
config
=
config
,
attempt
=
attempt_n
,
previous_job_id
=
previous_job_id
)
job
=
Job
(
gear_name
,
inputs
,
destination
=
destination
,
tags
=
tags
,
config
_
=
config
_
,
attempt
=
attempt_n
,
previous_job_id
=
previous_job_id
)
result
=
job
.
insert
()
return
{
"
_id
"
:
result
}
...
...
@@ -404,6 +404,32 @@ class JobHandler(base.RequestHandler):
return
Job
.
get
(
_id
)
def
get_config
(
self
,
_id
):
"""
.. http:get:: /api/jobs/x/config.json
Returns the job
'
s config as a downloadable json file
:statuscode 200: no error
**Example request**:
.. sourcecode:: http
GET /api/jobs/3/config.json HTTP/1.1
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Disposition: attachment; filename=
"
config.json
"
Content-Type: application/octet-stream
{
"
speed
"
: 5
}
"""
if
not
self
.
superuser_request
:
self
.
abort
(
403
,
'
Request requires superuser
'
)
...
...
This diff is collapsed.
Click to expand it.
api/jobs/jobs.py
+
3
−
3
View file @
b9667590
...
...
@@ -13,7 +13,7 @@ from .. import config
log
=
config
.
log
class
Job
(
object
):
def
__init__
(
self
,
name
,
inputs
,
destination
=
None
,
tags
=
None
,
attempt
=
1
,
previous_job_id
=
None
,
created
=
None
,
modified
=
None
,
state
=
'
pending
'
,
request
=
None
,
id_
=
None
,
config
=
None
):
def
__init__
(
self
,
name
,
inputs
,
destination
=
None
,
tags
=
None
,
attempt
=
1
,
previous_job_id
=
None
,
created
=
None
,
modified
=
None
,
state
=
'
pending
'
,
request
=
None
,
id_
=
None
,
config
_
=
None
):
"""
Creates a job.
...
...
@@ -77,7 +77,7 @@ class Job(object):
self
.
state
=
state
self
.
request
=
request
self
.
id_
=
id_
self
.
config
=
config
self
.
config
=
config
_
@classmethod
def
load
(
cls
,
e
):
...
...
@@ -100,7 +100,7 @@ class Job(object):
d
[
'
_id
'
]
=
str
(
d
[
'
_id
'
])
return
cls
(
d
[
'
name
'
],
d
.
get
(
'
inputs
'
,
None
),
destination
=
d
.
get
(
'
destination
'
,
None
),
tags
=
d
[
'
tags
'
],
attempt
=
d
[
'
attempt
'
],
previous_job_id
=
d
.
get
(
'
previous_job_id
'
,
None
),
created
=
d
[
'
created
'
],
modified
=
d
[
'
modified
'
],
state
=
d
[
'
state
'
],
request
=
d
.
get
(
'
request
'
,
None
),
id_
=
d
[
'
_id
'
],
config
=
d
.
get
(
'
config
'
,
None
))
return
cls
(
d
[
'
name
'
],
d
.
get
(
'
inputs
'
,
None
),
destination
=
d
.
get
(
'
destination
'
,
None
),
tags
=
d
[
'
tags
'
],
attempt
=
d
[
'
attempt
'
],
previous_job_id
=
d
.
get
(
'
previous_job_id
'
,
None
),
created
=
d
[
'
created
'
],
modified
=
d
[
'
modified
'
],
state
=
d
[
'
state
'
],
request
=
d
.
get
(
'
request
'
,
None
),
id_
=
d
[
'
_id
'
],
config
_
=
d
.
get
(
'
config
'
,
None
))
@classmethod
def
get
(
cls
,
_id
):
...
...
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