Skip to content
Snippets Groups Projects
Commit 6675447d authored by dilawar's avatar dilawar :ant:
Browse files

chore: Fixes to the new API.

parent 3d0703e7
No related branches found
No related tags found
1 merge request!2version 0.2.0
Pipeline #3697 failed with stages
in 1 minute and 50 seconds
...@@ -96,8 +96,8 @@ def submit_pipeline(user_input: str, server: str = DEFAULT_SERVER): ...@@ -96,8 +96,8 @@ def submit_pipeline(user_input: str, server: str = DEFAULT_SERVER):
def run_pipeline(user_input: str, server: str = DEFAULT_SERVER): def run_pipeline(user_input: str, server: str = DEFAULT_SERVER):
"""Run a pipeline""" """Run a pipeline"""
pipeline_zip = user_input_to_pipeline(user_input) pipeline_zip = user_input_to_pipeline(user_input)
containers = submit_job(pipeline_zip, server=server) res = submit_job(pipeline_zip, server=server)
return _log_container(containers, server=server) return _log_container(res["container"], server=server)
@app.command() @app.command()
...@@ -106,10 +106,10 @@ def version(): ...@@ -106,10 +106,10 @@ def version():
print(bitia.version()) print(bitia.version())
def _log_container(containers: T.List[T.Any], server: str): def _log_container(container: str, server: str):
for container in containers: logger.info(f"Fetching logs from {container}")
for line in _fetch_logs(container["Name"], server=server): for line in _fetch_logs(container, server=server):
print(line.decode().rstrip()) print(line.decode().rstrip())
def _check_server_status(server: str) -> int: def _check_server_status(server: str) -> int:
...@@ -240,7 +240,7 @@ def _fetch_logs(container: str, *, server): ...@@ -240,7 +240,7 @@ def _fetch_logs(container: str, *, server):
logger.info(f"Fetching logs for container `{container}`") logger.info(f"Fetching logs for container `{container}`")
return g_session.post( return g_session.post(
f"{server}/logs", f"{server}/logs",
json=dict(container=container, follow=True, tail=-1), json=dict(container=container, follow=True),
stream=True, stream=True,
) )
......
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