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

feat: get the logs from container.

parent 8666917e
No related branches found
No related tags found
1 merge request!2version 0.2.0
Pipeline #3724 failed with stages
in 1 minute and 41 seconds
......@@ -72,9 +72,7 @@ def list_remote_container(
params=dict(pipeline_sha256=pipeline_hash),
)
res.raise_for_status()
_json = res.json()
print(_json)
return _json["containers"]
return res.json()["containers"].split(",")
@app.command("logs")
......
......@@ -12,8 +12,9 @@ SESSION_PICKLE_FILE = bconfig.bitia_dir() / ".session.pickle"
def fetch_logs(container: str, *, server):
"""Fetch logs from a container."""
logger.info(f"Fetching logs for container `{container}`")
return g_session.post(
f"{server}/logs/?container={container}",
return get(
f"{server}/container/logs",
params=dict(container=container),
stream=True,
)
......
......@@ -9,10 +9,10 @@ def test_sanity():
def test_run_simple():
output = bitia.__main__.run_pipeline("ls -ltr /")
print(output)
output = bitia.__main__.run_pipeline("ls -ltr /", rerun=True)
print(output)
for line in bitia.__main__.run_pipeline("ls -ltr /"):
print(111, line.decode().rstrip())
for line in bitia.__main__.run_pipeline("ls -ltr /", rerun=True):
print(222, line.decode().rstrip())
if __name__ == "__main__":
......
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