1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8; -*-
3
3
4
- # Copyright (c) 2022 Oracle and/or its affiliates.
4
+ # Copyright (c) 2022, 2023 Oracle and/or its affiliates.
5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
6
7
7
8
- import os
9
- import tempfile
10
8
import json
9
+ import os
11
10
import shlex
11
+ import tempfile
12
+ import warnings
12
13
from getopt import gnu_getopt
13
14
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
19
18
from 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 )
24
21
25
22
26
23
def dataflow (line , cell = None ):
@@ -91,6 +88,8 @@ def dataflow_run(options, args, cell):
91
88
archive_name = options ["-a" ]
92
89
elif "--archive" in options :
93
90
archive_name = options ["--archive" ]
91
+ elif hasattr (dataflow_config , "archive_uri" ) and dataflow_config .archive_uri :
92
+ archive_name = dataflow_config .archive_uri
94
93
else :
95
94
archive_name = None
96
95
with tempfile .TemporaryDirectory () as td :
@@ -105,7 +104,11 @@ def dataflow_run(options, args, cell):
105
104
rt_spec ["args" ] = args [1 :]
106
105
if archive_name :
107
106
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
+ )
109
112
rt = DataFlowRuntime (rt_spec )
110
113
infra = DataFlow (spec = dataflow_config )
111
114
if "-o" in options or "--overwrite" in options :
0 commit comments