11#!/usr/bin/env python
22# -*- coding: utf-8; -*-
33
4- # Copyright (c) 2022 Oracle and/or its affiliates.
4+ # Copyright (c) 2022, 2023 Oracle and/or its affiliates.
55# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
77
8- import os
9- import tempfile
108import json
9+ import os
1110import shlex
11+ import tempfile
12+ import warnings
1213from getopt import gnu_getopt
1314
14- from ads .opctl .constants import (
15- ADS_DATAFLOW_CONFIG_FILE_NAME ,
16- DEFAULT_ADS_CONFIG_FOLDER ,
17- )
18- from ads .jobs import Job , DataFlow , DataFlowRuntime , DataFlowRun
15+ from ads .common .decorator .runtime_dependency import (OptionalDependency ,
16+ runtime_dependency )
17+ from ads .jobs import DataFlow , DataFlowRun , DataFlowRuntime , Job
1918from ads .jobs .utils import get_dataflow_config
20- from ads .common .decorator .runtime_dependency import (
21- runtime_dependency ,
22- OptionalDependency ,
23- )
19+ from ads .opctl .constants import (ADS_DATAFLOW_CONFIG_FILE_NAME ,
20+ DEFAULT_ADS_CONFIG_FOLDER )
2421
2522
2623def dataflow (line , cell = None ):
@@ -91,6 +88,8 @@ def dataflow_run(options, args, cell):
9188 archive_name = options ["-a" ]
9289 elif "--archive" in options :
9390 archive_name = options ["--archive" ]
91+ elif hasattr (dataflow_config , "archive_uri" ) and dataflow_config .archive_uri :
92+ archive_name = dataflow_config .archive_uri
9493 else :
9594 archive_name = None
9695 with tempfile .TemporaryDirectory () as td :
@@ -105,7 +104,11 @@ def dataflow_run(options, args, cell):
105104 rt_spec ["args" ] = args [1 :]
106105 if archive_name :
107106 rt_spec ["archiveUri" ] = archive_name
108- rt_spec ["archiveBucket" ] = dataflow_config .pop ("archive_bucket" )
107+ rt_spec ["archiveBucket" ] = dataflow_config .pop ("archive_bucket" , None )
108+ if not archive_name .startswith ("oci://" ) and not rt_spec ["archiveBucket" ]:
109+ raise ValueError (
110+ "`archiveBucket` has to be set in the config if `archive` is a local path."
111+ )
109112 rt = DataFlowRuntime (rt_spec )
110113 infra = DataFlow (spec = dataflow_config )
111114 if "-o" in options or "--overwrite" in options :
0 commit comments