Skip to content
Snippets Groups Projects

Fix/manual submit confirmation

Merged Robert Rosca requested to merge fix/manual-submit-confirmation into master
1 unresolved thread
1 file
+ 15
12
Compare changes
  • Side-by-side
  • Inline
+ 15
12
@@ -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
Loading