Skip to content

Commit 3e3bdae

Browse files
committed
Always set permissions for file generated or tracked by polyaxon
1 parent 5e4eba6 commit 3e3bdae

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import aiofiles
66

7-
from clipped.utils.paths import check_or_create_path
7+
from clipped.utils.paths import check_or_create_path, set_permissions
88
from kubernetes_asyncio.client.models import V1Pod
99

1010
from polyaxon._contexts import paths as ctx_paths
@@ -34,8 +34,8 @@ async def sync_logs(
3434

3535
path_from = "{}/{}.jsonl".format(path_from, pod.metadata.name)
3636
check_or_create_path(path_from, is_dir=False)
37-
async with aiofiles.open(path_from, "a") as filepath:
37+
async with aiofiles.open(path_from, "a") as outfile:
3838
_logs = V1Logs.construct(logs=logs)
39-
await filepath.write(_logs.get_jsonl_events())
40-
39+
await outfile.write(_logs.get_jsonl_events())
40+
set_permissions(path_from)
4141
return last_time

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import aiofiles
22

33
from clipped.utils.json import orjson_dumps
4-
from clipped.utils.paths import check_or_create_path
4+
from clipped.utils.paths import check_or_create_path, set_permissions
55

66
from polyaxon._contexts import paths as ctx_paths
77
from polyaxon._flow import V1RunKind
@@ -20,5 +20,6 @@ async def sync_spec(
2020
path_from = ctx_paths.CONTEXT_MOUNT_ARTIFACTS_FORMAT.format(run_uuid)
2121
path_from = "{}/outputs/spec.json".format(path_from)
2222
check_or_create_path(path_from, is_dir=False)
23-
async with aiofiles.open(path_from, "w") as filepath:
24-
await filepath.write(orjson_dumps(op_spec))
23+
async with aiofiles.open(path_from, "w") as outfile:
24+
await outfile.write(orjson_dumps(op_spec))
25+
set_permissions(path_from)

0 commit comments

Comments
 (0)