Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLT pipeline update details and DLT pipeline events list #654

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions databricks_cli/pipelines/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def start_update(self, pipeline_id, full_refresh=None, headers=None):
def stop(self, pipeline_id, headers=None):
self.client.stop(pipeline_id, headers)

def get_update_details(self, pipeline_id, update_id):
return self.client.get_update_details(pipeline_id, update_id)

def list_events(self, pipeline_id, query_filter=None):
return self.client.list_events(pipeline_id, query_filter)

def _upload_libraries_and_update_settings(self, settings, settings_dir):
settings = copy.deepcopy(settings)
lib_objects = LibraryObject.from_json(settings.get('libraries', []))
Expand Down
34 changes: 34 additions & 0 deletions databricks_cli/sdk/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,40 @@ def stop(self, pipeline_id=None, headers=None):
headers=headers,
)

def get_update_details(self, pipeline_id=None, update_id=None, headers=None):
_data = {}
return self.client.perform_query(
'GET',
'/pipelines/{pipeline_id}/updates/{update_id}'.format(pipeline_id=pipeline_id, update_id=update_id),
data=_data,
headers=headers,
)

def list_events(self, pipeline_id, query_filter=None):
def get_list_events(page_token=None, max_results=None, order_by=None):
_data = {}
if page_token:
_data["page_token"] = page_token
if max_results:
_data["max_results"] = max_results
if order_by:
_data["order_by"] = order_by
if query_filter:
_data["filter"] = query_filter
return self.client.client.perform_query(
'GET',
'/pipelines/{pipeline_id}/events'.format(pipeline_id=pipeline_id),
data=_data
)

response = get_list_events(pipeline_id, query_filter)
events = response.get("statuses", [])

while "next_page_token" in response:
response = get_list_events(page_token=response["next_page_token"])
events.extend(response.get("statuses", []))
return events


class ReposService(object):
__git_providers__ = {
Expand Down