Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
nomad-FAIR
Commits
f33d0421
Commit
f33d0421
authored
1 year ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Added a publish command to the cli.
Changelog: Added
parent
d19043a7
No related branches found
No related tags found
1 merge request
!1679
Added a publish command and util deployment.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nomad/cli/admin/uploads.py
+30
-0
30 additions, 0 deletions
nomad/cli/admin/uploads.py
tests/test_cli.py
+19
-0
19 additions, 0 deletions
tests/test_cli.py
with
49 additions
and
0 deletions
nomad/cli/admin/uploads.py
+
30
−
0
View file @
f33d0421
...
...
@@ -696,6 +696,36 @@ def process(
)
@uploads.command
(
help
=
'
Publish selected uploads.
'
)
@click.argument
(
'
UPLOADS
'
,
nargs
=-
1
)
@click.option
(
'
--parallel
'
,
default
=
1
,
type
=
int
,
help
=
'
Use the given amount of parallel processes. Default is 1.
'
,
)
@click.option
(
'
--embargo-length
'
,
default
=
None
,
type
=
int
,
help
=
'
Use an embargo length (months) for the publication.
'
,
)
@click.pass_context
def
publish
(
ctx
,
uploads
,
parallel
:
int
,
embargo_length
:
int
,
):
_
,
uploads
=
_query_uploads
(
uploads
,
**
ctx
.
obj
.
uploads_kwargs
)
_run_processing
(
uploads
,
parallel
,
lambda
upload
:
upload
.
publish_upload
(
embargo_length
=
embargo_length
),
'
publishing
'
,
)
@uploads.command
(
help
=
'
Repack selected uploads.
'
)
@click.argument
(
'
UPLOADS
'
,
nargs
=-
1
)
@click.pass_context
...
...
This diff is collapsed.
Click to expand it.
tests/test_cli.py
+
19
−
0
View file @
f33d0421
...
...
@@ -259,6 +259,25 @@ class TestAdminUploads:
entry
.
reload
()
assert
entry
.
nomad_version
==
'
test_version
'
def
test_publish
(
self
,
non_empty_processed
,
monkeypatch
):
monkeypatch
.
setattr
(
'
nomad.config.meta.version
'
,
'
test_version
'
)
upload_id
=
non_empty_processed
.
upload_id
upload
=
Upload
.
objects
(
upload_id
=
upload_id
).
first
()
assert
upload
.
publish_time
is
None
assert
upload
.
embargo_length
==
0
result
=
invoke_cli
(
cli
,
[
'
admin
'
,
'
uploads
'
,
'
publish
'
,
'
--embargo-length
'
,
'
2
'
,
upload_id
],
catch_exceptions
=
False
,
)
assert
result
.
exit_code
==
0
assert
'
publishing
'
in
result
.
stdout
upload
.
reload
()
assert
upload
.
publish_time
is
not
None
assert
upload
.
embargo_length
==
2
def
test_re_pack
(
self
,
published
,
monkeypatch
):
upload_id
=
published
.
upload_id
entry
=
Entry
.
objects
(
upload_id
=
upload_id
).
first
()
...
...
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