Skip to content

Commit

Permalink
Merge branch 'main' into feat/history-api
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Oct 16, 2024
2 parents 537cd03 + 25c623e commit 24a8941
Show file tree
Hide file tree
Showing 46 changed files with 1,372 additions and 302 deletions.
2 changes: 1 addition & 1 deletion lib/workload/stateless/stacks/workflow-manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ start: migrate
@python manage.py runserver_plus 0.0.0.0:8000

mock:
@python manage.py generate_mock_workflow_run
@python manage.py generate_analysis_for_metadata

run-mock: reset-db migrate mock start

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ serverless-wsgi==3.0.4
# for sequencerunstatechange package
six==1.16.0
regex==2024.7.24
ulid-py==1.1.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import hashlib
import ulid

from django.db import models
from django.core.validators import RegexValidator

orcabus_id_validator = RegexValidator(
regex=r'[\w]{26}$',
message='ULID is expected to be 26 characters long',
code='invalid_orcabus_id'
)


class OrcabusIdField(models.CharField):
description = "An OrcaBus internal ID (ULID)"

def __init__(self, prefix, *args, **kwargs):
kwargs["max_length"] = 26 # ULID length
kwargs['unique'] = True
kwargs['editable'] = False
kwargs['blank'] = False
kwargs['null'] = False
kwargs['default'] = ulid.new
kwargs['validators'] = [orcabus_id_validator]
super().__init__(*args, **kwargs)


class HashField(models.CharField):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
from django.core.management import BaseCommand
from django.db.models import QuerySet

from workflow_manager.models import WorkflowRun, Workflow, Payload
from workflow_manager.models import (
WorkflowRun,
Workflow,
Payload,
State,
Library,
LibraryAssociation,
Analysis,
AnalysisRun,
AnalysisContext
)


# https://docs.djangoproject.com/en/5.0/howto/custom-management-commands/
class Command(BaseCommand):
help = "Delete all DB data"

def handle(self, *args, **options):
Workflow.objects.all().delete()
WorkflowRun.objects.all().delete()
State.objects.all().delete()
Payload.objects.all().delete()
Workflow.objects.all().delete()
Library.objects.all().delete()
LibraryAssociation.objects.all().delete()
AnalysisContext.objects.all().delete()
AnalysisRun.objects.all().delete()
Analysis.objects.all().delete()

print("Done")
Loading

0 comments on commit 24a8941

Please sign in to comment.