Skip to content

Commit

Permalink
change the port value from a global variable to one retrieved by a fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
leahh committed Dec 17, 2024
1 parent 6753108 commit 663e88c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions beeflow/client/remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
from beeflow.common.config_driver import BeeConfig as bc


app = typer.Typer(no_args_is_help=True)
def remote_port_val():
"""Return the value of the remote port."""
return bc.get('DEFAULT', 'remote_api_port')


port = bc.get('DEFAULT', 'remote_api_port')
app = typer.Typer(no_args_is_help=True)


@app.command()
def connection(ssh_target: str = typer.Argument(..., help='the target to ssh to')):
"""Check the connection to Beeflow client via REST API."""
port = remote_port_val()
result = subprocess.run(["curl", f"{ssh_target}:{port}/"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE, text=True, check=True)
if result.returncode == 0:
Expand All @@ -33,6 +37,7 @@ def connection(ssh_target: str = typer.Argument(..., help='the target to ssh to'
@app.command()
def droppoint(ssh_target: str = typer.Argument(..., help='the target to ssh to')):
"""Request drop point location on remote machine via Beeflow client REST API."""
port = remote_port_val()
with open('droppoint.env', 'w', encoding='utf-8') as output_file:
subprocess.run(["curl", f"{ssh_target}:{port}/droppoint"], stdout=output_file, check=True)

Expand Down Expand Up @@ -64,4 +69,5 @@ def submit(ssh_target: str = typer.Argument(..., help='the target to ssh to'),
main_cwl_file: str = typer.Argument(..., help='filename of main CWL'),
job_file: str = typer.Argument(..., help='filename of yaml file')):
"""Submit the workflow to Beeflow client."""
port = remote_port_val()
subprocess.run(["curl", f"{ssh_target}:{port}/submit_long/{wf_name}/{tarball_name}/{main_cwl_file}/{job_file}"], check=True)

0 comments on commit 663e88c

Please sign in to comment.