-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting integration with orchestration
- Loading branch information
1 parent
1b415a2
commit 630941e
Showing
64 changed files
with
1,503 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.6 on 2024-05-27 21:32 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0028_productfile_created_productfile_updated'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Pipeline', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255)), | ||
('display_name', models.CharField(max_length=255)), | ||
('version', models.CharField(max_length=55)), | ||
('description', models.TextField(blank=True, null=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('system_config', models.JSONField(blank=True, null=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Generated by Django 5.0.6 on 2024-05-28 15:39 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0029_pipeline'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Process', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('pipeline_version', models.CharField(blank=True, default=None, max_length=255, null=True)), | ||
('used_config', models.JSONField(blank=True, null=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('started_at', models.DateTimeField(blank=True, null=True)), | ||
('ended_at', models.DateTimeField(blank=True, null=True)), | ||
('task_id', models.CharField(blank=True, default=None, max_length=255, null=True)), | ||
('status', models.CharField(default='Pending', max_length=55)), | ||
('path', models.FilePathField(blank=True, default=None, null=True, verbose_name='Path')), | ||
('comment', models.TextField(blank=True, null=True)), | ||
('inputs', models.ManyToManyField(related_name='processes', to='core.product')), | ||
('pipeline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='processes', to='core.pipeline')), | ||
('release', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='processes', to='core.release')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='processes', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
backend/core/migrations/0031_pipeline_product_types_accepted.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.6 on 2024-05-29 15:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0030_process'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='pipeline', | ||
name='product_types_accepted', | ||
field=models.ManyToManyField(related_name='pipelines', to='core.producttype'), | ||
), | ||
] |
25 changes: 25 additions & 0 deletions
25
backend/core/migrations/0032_process_upload_alter_process_inputs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.6 on 2024-05-29 17:45 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0031_pipeline_product_types_accepted'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='process', | ||
name='upload', | ||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='upload', to='core.product'), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='process', | ||
name='inputs', | ||
field=models.ManyToManyField(related_name='inputs', to='core.product'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.6 on 2024-05-29 17:55 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0032_process_upload_alter_process_inputs'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='process', | ||
name='upload', | ||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='upload', to='core.product'), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
backend/core/migrations/0034_process_upload_product_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 5.0.6 on 2024-05-29 22:01 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0033_alter_process_upload'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='process', | ||
name='upload_product_type', | ||
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, related_name='upload_product_type', to='core.producttype'), | ||
preserve_default=False, | ||
), | ||
] |
30 changes: 30 additions & 0 deletions
30
backend/core/migrations/0035_remove_process_upload_product_type_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 5.0.6 on 2024-05-31 14:53 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0034_process_upload_product_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='process', | ||
name='upload_product_type', | ||
), | ||
migrations.AddField( | ||
model_name='pipeline', | ||
name='output_product_type', | ||
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, related_name='output_product_type', to='core.producttype'), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='process', | ||
name='display_name', | ||
field=models.CharField(default='Test DN', max_length=255), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from core.models.release import Release | ||
from core.models.product_type import ProductType | ||
from core.models.product import Product | ||
from core.models.product import Product, ProductStatus | ||
from core.models.product_content import ProductContent | ||
from core.models.product_file import ProductFile | ||
from core.models.user_profile import Profile | ||
from core.models.pipeline import Pipeline | ||
from core.models.process import Process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from core.models import ProductType | ||
from django.db import models | ||
|
||
|
||
class Pipeline(models.Model): | ||
|
||
name = models.CharField(max_length=255) | ||
display_name = models.CharField(max_length=255) | ||
version = models.CharField(max_length=55) | ||
description = models.TextField(null=True, blank=True) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
system_config = models.JSONField(null=True, blank=True) | ||
product_types_accepted= models.ManyToManyField( | ||
ProductType, related_name="pipelines" | ||
) | ||
output_product_type = models.ForeignKey( | ||
ProductType, | ||
on_delete=models.CASCADE, | ||
related_name="output_product_type", | ||
) | ||
|
||
def __str__(self): | ||
return f"{self.display_name}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import pathlib | ||
import shutil | ||
|
||
from core.models import Pipeline, Product, ProductStatus, Release | ||
from django.conf import settings | ||
from django.contrib.auth.models import User | ||
from django.db import models | ||
|
||
|
||
class Process(models.Model): | ||
display_name = models.CharField(max_length=255) | ||
pipeline = models.ForeignKey( | ||
Pipeline, on_delete=models.CASCADE, related_name="processes" | ||
) | ||
pipeline_version = models.CharField( | ||
max_length=255, null=True, blank=True, default=None | ||
) | ||
used_config = models.JSONField(null=True, blank=True) | ||
inputs = models.ManyToManyField(Product, related_name="inputs") | ||
release = models.ForeignKey( | ||
Release, | ||
on_delete=models.CASCADE, | ||
related_name="processes", | ||
null=True, | ||
blank=True, | ||
default=None, | ||
) | ||
upload = models.OneToOneField( | ||
Product, | ||
on_delete=models.CASCADE, | ||
related_name="upload", | ||
) | ||
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="processes") | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
started_at = models.DateTimeField(null=True, blank=True) | ||
ended_at = models.DateTimeField(null=True, blank=True) | ||
task_id = models.CharField(max_length=255, null=True, blank=True, default=None) | ||
status = models.IntegerField( | ||
verbose_name="Status", | ||
default=ProductStatus.REGISTERING, | ||
choices=ProductStatus.choices, | ||
) | ||
path = models.FilePathField( | ||
verbose_name="Path", null=True, blank=True, default=None | ||
) | ||
comment = models.TextField(null=True, blank=True) | ||
|
||
def __str__(self): | ||
return f"{self.pipeline}-{str(self.pk).zfill(8)}" | ||
|
||
def delete(self, *args, **kwargs): | ||
process_path = pathlib.Path(settings.PROCESSING_DIR, str(self.path)) | ||
if process_path.exists(): | ||
self.rmtree(process_path) | ||
|
||
super().delete(*args, **kwargs) | ||
|
||
@staticmethod | ||
def rmtree(process_path): | ||
try: | ||
# WARN: is not run by admin | ||
shutil.rmtree(process_path) | ||
except OSError as e: | ||
raise OSError("Failed to remove directory: [ %s ] %s" % (process_path, e)) |
Oops, something went wrong.