Skip to content
Snippets Groups Projects
Commit a9131550 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

Merge branch 'fix/manual-submit-confirmation' into 'master'

Fix/manual submit confirmation

See merge request !904
parents 6b696b69 0e2fa35d
No related branches found
No related tags found
1 merge request!904Fix/manual submit confirmation
...@@ -18,7 +18,7 @@ from rich.progress import ( ...@@ -18,7 +18,7 @@ from rich.progress import (
TextColumn, TextColumn,
TimeElapsedColumn, TimeElapsedColumn,
) )
from rich.prompt import Prompt from rich.prompt import Confirm
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Manually submit calibration jobs.", description="Manually submit calibration jobs.",
...@@ -82,14 +82,17 @@ def get_bearer_token() -> str: ...@@ -82,14 +82,17 @@ def get_bearer_token() -> str:
return BEARER["access_token"] return BEARER["access_token"]
with Client() as client: with Client() as client:
response = client.post( data = {
f"{config['metadata-client']['token-url']}", "grant_type": "client_credentials",
data={ "client_id": config["metadata-client"]["user-id"],
"grant_type": "client_credentials", "client_secret": config["metadata-client"]["user-secret"],
"client_id": config["metadata-client"]["user-id"], }
"client_secret": config["metadata-client"]["user-secret"],
}, # With a real user the scope must be set to public
) if not str(config["metadata-client"]["user-email"]).endswith("example.com"):
data["scope"] = "public"
response = client.post(f"{config['metadata-client']['token-url']}", data=data)
data = response.json() data = response.json()
...@@ -192,9 +195,9 @@ def main( ...@@ -192,9 +195,9 @@ def main(
if not really: if not really:
print("[yellow]`--really` flag missing, not submitting jobs") print("[yellow]`--really` flag missing, not submitting jobs")
if not noconfirm and not Prompt.ask( if not noconfirm and not Confirm.ask(
f"Submit [red bold]{len(requests)}[/red bold] jobs for proposal " f"Submit [red bold]{len(requests)}[/red bold] jobs for proposal "
f"[bold]{proposal_no}[/bold]? [y/[bold]n[/bold]]", f"[bold]{proposal_no}[/bold]?",
default=False, default=False,
): ):
print("[bold red]Aborted[/bold red]") print("[bold red]Aborted[/bold red]")
...@@ -212,7 +215,7 @@ def main( ...@@ -212,7 +215,7 @@ def main(
) )
con = zmq.Context() con = zmq.Context()
socket = con.socket(zmq.REQ) socket = con.socket(zmq.REQ)
con = socket.connect("tcp://max-exfl-cal001:5555") socket.connect("tcp://max-exfl-cal001:5555")
if not really: if not really:
# Fake socket for testing, just logs what would have been sent via ZMQ # Fake socket for testing, just logs what would have been sent via ZMQ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment