@@ -40,14 +40,14 @@ def __init__(self, api_client):
4040 self .client = DeltaPipelinesService (api_client )
4141 self .dbfs_client = DbfsApi (api_client )
4242
43- def create (self , spec , spec_dir , allow_duplicate_names , headers = None ):
44- data = self ._upload_libraries_and_update_spec ( spec , spec_dir )
43+ def create (self , settings , settings_dir , allow_duplicate_names , headers = None ):
44+ data = self ._upload_libraries_and_update_settings ( settings , settings_dir )
4545 data ['allow_duplicate_names' ] = allow_duplicate_names
4646 return self .client .client .perform_query ('POST' , '/pipelines' , data = data ,
4747 headers = headers )
4848
49- def deploy (self , spec , spec_dir , allow_duplicate_names , headers = None ):
50- data = self ._upload_libraries_and_update_spec ( spec , spec_dir )
49+ def edit (self , settings , settings_dir , allow_duplicate_names , headers = None ):
50+ data = self ._upload_libraries_and_update_settings ( settings , settings_dir )
5151 data ['allow_duplicate_names' ] = allow_duplicate_names
5252 pipeline_id = data ['id' ]
5353 self .client .client .perform_query ('PUT' , '/pipelines/{}' .format (pipeline_id ), data = data ,
@@ -86,14 +86,15 @@ def start_update(self, pipeline_id, full_refresh=None, headers=None):
8686 def stop (self , pipeline_id , headers = None ):
8787 self .client .stop (pipeline_id , headers )
8888
89- def _upload_libraries_and_update_spec (self , spec , spec_dir ):
90- spec = copy .deepcopy (spec )
91- lib_objects = LibraryObject .from_json (spec .get ('libraries' , []))
89+ def _upload_libraries_and_update_settings (self , settings , settings_dir ):
90+ settings = copy .deepcopy (settings )
91+ lib_objects = LibraryObject .from_json (settings .get ('libraries' , []))
9292 local_lib_objects , external_lib_objects = self ._identify_local_libraries (lib_objects )
9393
94- spec ['libraries' ] = LibraryObject .to_json (
95- external_lib_objects + self ._upload_local_libraries (spec_dir , local_lib_objects ))
96- return spec
94+ settings ['libraries' ] = LibraryObject .to_json (
95+ external_lib_objects + self ._upload_local_libraries (
96+ settings_dir , local_lib_objects ))
97+ return settings
9798
9899 @staticmethod
99100 def _identify_local_libraries (lib_objects ):
@@ -124,9 +125,10 @@ def _identify_local_libraries(lib_objects):
124125 external_lib_objects .append (lib_object )
125126 return local_lib_objects , external_lib_objects
126127
127- def _upload_local_libraries (self , spec_dir , local_lib_objects ):
128- relative_local_lib_objects = [LibraryObject (llo .lib_type , os .path .join (spec_dir , llo .path ))
129- for llo in local_lib_objects ]
128+ def _upload_local_libraries (self , settings_dir , local_lib_objects ):
129+ relative_local_lib_objects = [
130+ LibraryObject (
131+ llo .lib_type , os .path .join (settings_dir , llo .path )) for llo in local_lib_objects ]
130132 remote_lib_objects = [LibraryObject (rllo .lib_type , self ._get_hashed_path (rllo .path ))
131133 for rllo in relative_local_lib_objects ]
132134 transformed_remote_lib_objects = [LibraryObject (rlo .lib_type , DbfsPath (rlo .path ))
0 commit comments