Skip to content
Snippets Groups Projects
Commit f33d0421 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added a publish command to the cli.

Changelog: Added
parent d19043a7
No related branches found
No related tags found
1 merge request!1679Added a publish command and util deployment.
......@@ -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
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment