Skip to content

Commit cf03239

Browse files
committed
Improve ops pull logic and allow ignoring artifacts store to use the default one
* Adds --ignore-store option to CLI
1 parent 9f79ab4 commit cf03239

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

cli/polyaxon/_cli/operations.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,12 @@ def _pull(run_uuid: str):
23282328
default=False,
23292329
help="Optional, to ignore the agent host.",
23302330
)
2331+
@click.option(
2332+
"--ignore-store",
2333+
is_flag=True,
2334+
default=False,
2335+
help="Optional, to ignore the store information of the run and use the default store of the server.",
2336+
)
23312337
@click.option("--name", "-n", type=str, help="Optional, a new name to set for the run.")
23322338
@click.pass_context
23332339
@clean_outputs
@@ -2343,6 +2349,7 @@ def push(
23432349
reset_uuid,
23442350
agent,
23452351
ignore_agent_host,
2352+
ignore_store,
23462353
name,
23472354
):
23482355
"""Push a local run (or all runs) to a remove server.
@@ -2367,7 +2374,7 @@ def push(
23672374
$ polyaxon ops push -uid 8aac02e3a62a4f0aaa257c59da5eab80 --reset-project
23682375
23692376
\b
2370-
$ polyaxon ops push -uid 8aac02e3a62a4f0aaa257c59da5eab80 --ignore-agent-host
2377+
$ polyaxon ops push -uid 8aac02e3a62a4f0aaa257c59da5eab80 --ignore-agent-host --ignore-store
23712378
23722379
\b
23732380
$ polyaxon ops push -uid 8aac02e3a62a4f0aaa257c59da5eab80 --reset-project -p send-to-project
@@ -2415,6 +2422,7 @@ def _push(run_uuid: str):
24152422
clean=clean,
24162423
agent=agent,
24172424
ignore_agent_host=ignore_agent_host,
2425+
ignore_store=ignore_store,
24182426
)
24192427
Printer.success(
24202428
f"Finished pushing offline run {uid} to {client.owner}/{client.project}"

cli/polyaxon/_client/run.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,7 @@ def upload_artifacts_dir(
15781578
relative_to: Optional[str] = None,
15791579
agent: Optional[str] = None,
15801580
ignore_agent_host: bool = False,
1581+
ignore_store: Optional[bool] = None,
15811582
):
15821583
"""Uploads a full directory to the run's artifacts store path.
15831584
@@ -1592,6 +1593,7 @@ def upload_artifacts_dir(
15921593
and you want to cancel the relative path.
15931594
agent: str, optional, uuid reference of an agent to use.
15941595
ignore_agent_host: bool, optional, flag to ignore agent host
1596+
ignore_store: bool, optional, flag to ignore the ignore store and upload all files under the dirpath.
15951597
Returns:
15961598
str.
15971599
"""
@@ -1613,6 +1615,7 @@ def upload_artifacts_dir(
16131615
relative_to=relative_to,
16141616
agent=agent,
16151617
ignore_agent_host=ignore_agent_host,
1618+
ignore_store=ignore_store,
16161619
)
16171620

16181621
@client_handler(check_no_op=True, check_offline=True)
@@ -1624,6 +1627,7 @@ def upload_artifacts(
16241627
relative_to: Optional[str] = None,
16251628
agent: Optional[str] = None,
16261629
ignore_agent_host: bool = False,
1630+
ignore_store: Optional[bool] = None,
16271631
):
16281632
"""Uploads multiple artifacts to the run's artifacts store path.
16291633
@@ -1635,6 +1639,7 @@ def upload_artifacts(
16351639
and you want to cancel the relative path.
16361640
agent: str, optional, uuid reference of an agent to use.
16371641
ignore_agent_host: bool, optional, flag to ignore agent host
1642+
ignore_store: bool, optional, flag to ignore the ignore store and upload all files under the dirpath.
16381643
Returns:
16391644
str.
16401645
"""
@@ -1648,8 +1653,11 @@ def upload_artifacts(
16481653
self._reset_agent(agent)
16491654
if not ignore_agent_host:
16501655
self._use_agent_host()
1651-
1652-
params = get_streams_params(connection=self.artifacts_store)
1656+
params = (
1657+
get_streams_params(connection=self.artifacts_store)
1658+
if not ignore_store
1659+
else {}
1660+
)
16531661
url = get_proxy_run_url(
16541662
service=STREAMS_V1_LOCATION,
16551663
namespace=self.namespace,
@@ -3040,6 +3048,7 @@ def push_offline_run(
30403048
clean: bool = False,
30413049
agent: Optional[str] = None,
30423050
ignore_agent_host: bool = False,
3051+
ignore_store: bool = False,
30433052
):
30443053
"""Syncs an offline run to Polyaxon's API and artifacts store.
30453054
@@ -3050,6 +3059,7 @@ def push_offline_run(
30503059
clean: bool, optional, flag to clean local path after pushing the run.
30513060
agent: str, optional, uuid reference of an agent to use.
30523061
ignore_agent_host: bool, optional, flag to ignore agent host
3062+
ignore_store: bool, optional, flag to ignore artifacts store and only push the run metadata and lineage.
30533063
"""
30543064
# We ensure that the is_offline is False
30553065
is_offline = self._is_offline
@@ -3084,6 +3094,7 @@ def push_offline_run(
30843094
relative_to=path,
30853095
agent=agent,
30863096
ignore_agent_host=ignore_agent_host,
3097+
ignore_store=ignore_store,
30873098
)
30883099
logger.info(f"Offline artifacts for run {self.run_data.uuid} uploaded")
30893100

cli/polyaxon/_client/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _upload_impl(callback=None):
137137
return _upload_impl()
138138

139139
with Printer.get_progress() as progress:
140-
task = progress.add_task("[cyan]Uploading contents:", total=files_size)
140+
task = progress.add_task("[cyan]Uploading content:", total=files_size)
141141

142142
def progress_callback(monitor):
143143
progress.update(task, completed=monitor.bytes_read)
@@ -219,7 +219,7 @@ def _download_impl():
219219
if show_progress:
220220
with Printer.get_progress() as progress:
221221
task = progress.add_task(
222-
"Writing contents:", total=content_length
222+
"Writing content:", total=content_length
223223
)
224224
_download_impl()
225225
else:

0 commit comments

Comments
 (0)