Skip to content

Commit ce02348

Browse files
committed
Use utils to get logs path
1 parent 01df3ec commit ce02348

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

cli/polyaxon/_cli/operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
PolyaxonShouldExitError,
6060
)
6161
from polyaxon.logger import clean_outputs
62+
from traceml.events import get_logs_path
6263

6364
DEFAULT_EXCLUDE = [
6465
"owner",
@@ -1449,7 +1450,7 @@ def logs(ctx, project, uid, follow, hide_time, all_containers, all_info, offline
14491450
offline_path = ctx_paths.get_offline_path(
14501451
entity_value=uid, entity_kind=V1ProjectFeature.RUNTIME, path=path
14511452
)
1452-
logs_path = "{}/plxlogs".format(offline_path)
1453+
logs_path = get_logs_path(run_path=offline_path, full_path=False)
14531454
offline_path = "{}/{}".format(offline_path, ctx_paths.CONTEXT_LOCAL_RUN)
14541455
if not os.path.exists(offline_path):
14551456
Printer.error(

cli/polyaxon/_sidecar/container/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async def monitor():
129129
while is_running:
130130
await asyncio.sleep(sleep_interval)
131131
if retry:
132-
await asyncio.sleep(retry ** 2)
132+
await asyncio.sleep(retry**2)
133133
try:
134134
is_running = await k8s_manager.is_pod_running(pod_id, container_id)
135135
except ApiException as e:

cli/polyaxon/_sidecar/container/monitors/logs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from polyaxon._k8s.logging.async_monitor import query_k8s_pod_logs
1212
from polyaxon._k8s.manager.async_manager import AsyncK8sManager
1313
from traceml.logging import V1Logs
14+
from traceml.events import get_logs_path
1415

1516

1617
async def sync_logs(
@@ -20,9 +21,6 @@ async def sync_logs(
2021
last_time: Optional[datetime.datetime],
2122
stream: bool = False,
2223
) -> Optional[datetime.datetime]:
23-
path_from = ctx_paths.CONTEXT_MOUNT_ARTIFACTS_FORMAT.format(run_uuid)
24-
path_from = "{}/plxlogs".format(path_from)
25-
2624
logs, last_time = await query_k8s_pod_logs(
2725
k8s_manager=k8s_manager,
2826
pod=pod,
@@ -32,7 +30,10 @@ async def sync_logs(
3230
if not logs:
3331
return last_time
3432

35-
path_from = "{}/{}.jsonl".format(path_from, pod.metadata.name)
33+
path_from = get_logs_path(
34+
run_path=ctx_paths.CONTEXT_MOUNT_ARTIFACTS_FORMAT.format(run_uuid),
35+
filename=pod.metadata.name,
36+
)
3637
check_or_create_path(path_from, is_dir=False)
3738
async with aiofiles.open(path_from, "a") as outfile:
3839
_logs = V1Logs.construct(logs=logs)

0 commit comments

Comments
 (0)