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

feat: API to list executions and filter by entity type #1103

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chandrasekharan-zipstack
Copy link
Contributor

@chandrasekharan-zipstack chandrasekharan-zipstack commented Jan 29, 2025

What

  • API to list and filter executions by entity type (ETL, API, TASK and WF), date range with pagination and ordering by created_at
  • API to list file executions assoicated with an execution (along with its latest log)
  • Added URL to support existing logs listing API easily
  • Added execution app within workflow_manager
  • Minor changes / refactoring of existing code
  • NOTE: Support for prompt studio executions will be tackled separately

API added

  1. List executions, also accepts start_date / end_date / ordering
GET /api/v1/unstract/mock_org/execution/?execution_entity=API&page_size=10&page=1 HTTP/1.1
  1. List file executions
GET /api/v1/unstract/mock_org/execution/b02a5c50-0482-4735-b864-5957de71f41f/files/ HTTP/1.1
  1. List logs
GET /api/v1/unstract/mock_org/execution/1b853ee4-17f4-4346-b05c-8ca7affd45c4/logs/?page_size=10&page=1 HTTP/1.1

Why

  • To support file centric logging to provide a view of all executions happening within the system

How

  • Added a new app executions to provide this API using the existing WorkflowExecution model
  • Query all pipelines first and then use it to query for executions based on the entity type

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No, only new changes are added

Database Migrations

  • Added a schema migration to add index for pipeline and workflow ID columns in workflow execution

Notes on Testing

  • Tested the API locally and tried other APIs to ensure nothing else breaks

Screenshots

image

Checklist

I have read and understood the Contribution Guidelines.

backend/backend/settings/base.py Outdated Show resolved Hide resolved
backend/execution/serializer.py Outdated Show resolved Hide resolved
backend/execution/serializer.py Outdated Show resolved Hide resolved
backend/execution/views.py Outdated Show resolved Hide resolved
backend/execution/views.py Outdated Show resolved Hide resolved
@muhammad-ali-e
Copy link
Contributor

Please remove migration files if not required

Copy link
Contributor

github-actions bot commented Feb 4, 2025

filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{9}}$$ $$\textcolor{#23d18b}{\tt{9}}$$

Copy link

sonarqubecloud bot commented Feb 4, 2025

Copy link
Contributor

@muhammad-ali-e muhammad-ali-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants