Skip to content

Commit

Permalink
remove Event model and all associated endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 12, 2023
1 parent b895de1 commit 904cfa5
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 3,787 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking Changes
- runPipeline request schema changed. 'params' was changed to 'args'
- runPipeline response schema change. Now returns a RespPipelineRun; previously return RespEvent
- runPipeline OpenAPI spec to reflect the change in the request and response schema - requires regenerating tapipy and tapis-typescript. Will break UI that depend on tapis-typescript
- removed the Event model and all associated endpoints, req/resp schemas, and req/resp models in the OpenAPI spec
- changed the endpoint of the runPipeline operation from `.../events` to `.../run`
- updated the OpenAPI spec to reflect the change in the url endpoint for the runPipeline operation
- removed the runPipelineWebhook endpoints, req/resp schemas, and req/resp models in the OpenAPI spec

### Features
- Initial release of the owe-python-sdk. Used in both the workflow engine and Tapis Workflows API
Expand All @@ -20,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Templating and Inheritence**
- Introduced the template type task
- Added pipeline and task inheritence via the 'uses' property on pipelines and tasks
- **Tapis ETL Pipeline**
-

### non-Breaking Changes
- Refactored Tapis-specific logic from the workflow engine into a Plugin
Expand Down
File renamed without changes.
144 changes: 10 additions & 134 deletions src/api/specs/WorkflowsAPI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ tags:
description: Manage collections of tasks. Create, retrieve and delete.
- name: Tasks
description: Manage tasks to be executed as part of a workflow. Create, retrieve and delete.
- name: Events
description: Trigger workflows. Create and retrieve.
- name: CI/CD
description: Create CI/CD-specific workflows (Image builds and http requests).

Expand Down Expand Up @@ -1345,40 +1343,6 @@ paths:
schema:
$ref: '#/components/schemas/RespError'

'/v3/workflows/groups/{group_id}/pipelines/{pipeline_id}/webhook':
post:
tags:
- Events
summary: Trigger a pipeline run
description: |
Trigger a pipeline run
operationId: runPipelineWebhook
parameters:
- name: group_id
in: path
required: true
schema:
$ref: '#/components/schemas/ID'
- name: pipeline_id
in: path
required: true
schema:
$ref: '#/components/schemas/ID'
requestBody:
required: true
description: A JSON object specifying information for the pipeline to be created.
content:
application/json:
schema:
$ref: '#/components/schemas/ReqWebhookEvent'
responses:
'200':
description: Events found.
content:
application/json:
schema:
$ref: '#/components/schemas/RespEvent'

'/v3/workflows/groups/{group_id}/pipelines/{pipeline_id}/tasks':
post:
tags:
Expand Down Expand Up @@ -1773,35 +1737,10 @@ paths:
schema:
$ref: '#/components/schemas/RespTaskExecutionList'

'/v3/workflows/groups/{group_id}/pipelines/{pipeline_id}/events':
get:
tags:
- Events
summary: Retrieve Event details
description: |
Retrieve all events for a given pipeline
operationId: listEvents
parameters:
- name: group_id
in: path
required: true
schema:
$ref: '#/components/schemas/ID'
- name: pipeline_id
in: path
required: true
schema:
$ref: '#/components/schemas/ID'
responses:
'200':
description: Events found.
content:
application/json:
schema:
$ref: '#/components/schemas/RespEvent'
'/v3/workflows/groups/{group_id}/pipelines/{pipeline_id}/run':
post:
tags:
- Events
- Pipelines
summary: Trigger a pipeline run
description: |
Trigger a pipeline run
Expand All @@ -1826,11 +1765,11 @@ paths:
$ref: '#/components/schemas/ReqRunPipeline'
responses:
'200':
description: Events found.
description: Pipeline triggered successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RespEvent'
$ref: '#/components/schemas/RespPipelineRun'

# ------------------------------------------------------------------------------
# --- Components ---------------------------------------------------------------
Expand All @@ -1855,6 +1794,10 @@ components:
type: object
additionalProperties: true

Args:
type: object
additionalProperties: true

ExecutionProfile:
type: object
properties:
Expand Down Expand Up @@ -2249,38 +2192,6 @@ components:
credentials:
type: string

Event:
type: object
properties:
branch:
type: string
default: null
commit:
type: string
default: null
commit_sha:
type: string
default: null
context_url:
type: string
default: null
directives:
type: string
message:
type: string
pipeline:
type: string
source:
type: string
username:
$ref: '#/components/schemas/Username'
identity:
type: string
default: null
uuid:
type: string
format: uuid

GitRepository:
type: object
properties:
Expand Down Expand Up @@ -2856,27 +2767,11 @@ components:
ReqTapisJobDef:
$ref: "https://raw.githubusercontent.com/tapis-project/tapis-client-java/prod/jobs-client/src/main/resources/JobsAPI.yaml#components/schemas/ReqSubmitJob"

ReqWebhookEvent:
type: object
properties:
branch:
type: string
commit:
type: string
commit_sha:
type: string
source:
$ref: '#/components/schemas/EnumContextType'
context_url:
type: string
username:
type: string

ReqRunPipeline:
type: object
properties:
params:
$ref: "#/components/schemas/Params"
args:
$ref: "#/components/schemas/Args"
directives:
type: array
items:
Expand Down Expand Up @@ -2913,7 +2808,6 @@ components:
properties:
logs:
type: string


# -------------------------------------------------------------------------
# --- Response objects ----------------------------------------------------
Expand Down Expand Up @@ -3135,24 +3029,6 @@ components:
items:
$ref: '#/components/schemas/Task'

RespEvent:
allOf:
- $ref: '#/components/schemas/RespObject'
- type: object
properties:
result:
$ref: '#/components/schemas/Event'

# RespEventList:
# allOf:
# - $ref: '#/components/schemas/RespList'
# - type: object
# properties:
# result:
# type: array
# items:
# $ref: '#/components/schemas/Event'

# -------------------------------------------------------------------------
# --- Enums ---------------------------------------------------------------
# -------------------------------------------------------------------------
Expand Down
20 changes: 0 additions & 20 deletions src/api/src/backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,6 @@ class Destination(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)
identity = models.ForeignKey("backend.Identity", null=True, on_delete=models.CASCADE)

class Event(models.Model):
branch = models.CharField(max_length=255, null=True)
commit = models.TextField(max_length=255, null=True)
commit_sha = models.CharField(max_length=128, null=True)
context_url = models.CharField(max_length=128, null=True)
created_at = models.DateTimeField(auto_now_add=True)
cron = models.CharField(null=True, max_length=128)
directives = models.JSONField(null=True)
group = models.ForeignKey("backend.Group", related_name="events", null=True, on_delete=models.CASCADE)
message = models.TextField()
pipeline = models.ForeignKey("backend.Pipeline", related_name="events", null=True, on_delete=models.CASCADE)
source = models.CharField(max_length=255)
username = models.CharField(max_length=64, null=True)
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)
class Meta:
indexes = [
models.Index(fields=["pipeline_id"]),
models.Index(fields=["username"])
]

class Group(models.Model):
id = models.CharField(validators=[validate_id], max_length=128, unique=True)
created_at = models.DateTimeField(auto_now_add=True)
Expand Down
2 changes: 2 additions & 0 deletions src/api/src/backend/services/PipelineDispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def dispatch(self, service_request: dict, pipeline):
message = f"Failed publish the service request to the message broker: {e.__cause__}"
logging.error(message)
raise ServerError(message=message)

return pipeline_run

def _uuid_convert(self, obj):
if isinstance(obj, UUID):
Expand Down
9 changes: 2 additions & 7 deletions src/api/src/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

from backend.views.Tasks import Tasks
from backend.views.Auth import Auth
from backend.views.RunPipelineWebhook import RunPipelineWebhook
from backend.views.Events import Events
from backend.views.RunPipeline import RunPipeline
from backend.views.Groups import Groups
from backend.views.HealthCheck import HealthCheck
from backend.views.Identities import Identities
Expand Down Expand Up @@ -63,11 +62,7 @@
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/archives/remove", RemovePipelineArchive.as_view(), name="removePipelineArchive"),

# Trigger pipelines
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/webhook", RunPipelineWebhook.as_view(), name="runPipelineWebhook"),
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/events", Events.as_view(), name="events"),

# Events
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/events/<str:event_uuid>", Events.as_view(), name="event"),
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/run", RunPipeline.as_view(), name="runPipeline"),

# Pipeline Runs
path("groups/<str:group_id>/pipelines/<str:pipeline_id>/runs", PipelineRuns.as_view(), name="pipelineRuns"),
Expand Down
Loading

0 comments on commit 904cfa5

Please sign in to comment.