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

Ability to disable a pipeline for a given project #695

Open
mihow opened this issue Jan 26, 2025 · 2 comments
Open

Ability to disable a pipeline for a given project #695

mihow opened this issue Jan 26, 2025 · 2 comments
Assignees
Labels

Comments

@mihow
Copy link
Collaborator

mihow commented Jan 26, 2025

When a project registers a Processing Service, all pipelines are added to the project and made available to users. However the project manager will likely only want to make a subset of the pipelines available to the project users. For example, if you add our default Rolnick Lab processing service, all regional models get added to your project as choices for processing images. However you probably don't want users to accidentally select the Costa Rica model in Denmark, or older models. We plan to have a method of auto-selecting regional models in the future based on a geographic shapefile, however there are already a lot of models and a way to limit the choices per project manually seems necessary.

@vanessavmac
Copy link
Collaborator

  • Add an intermediate model containing an "enabled" field. A pipeline is enabled for a project. There's many-to-many relationship between pipelines and projects.
  • Add another column to the pipelines overview with the enabled status
  • all pipelines from that projects should still be visible

@mihow
Copy link
Collaborator Author

mihow commented Feb 4, 2025

Example of an intermediate model with "through fields"

class Project(models.Model):
    name = models.CharField(max_length=128)

    def __str__(self):
        return self.name


class Pipeline(models.Model):
    name = models.CharField(max_length=128)
    projects = models.ManyToManyField(Project, through="ProjectPipelineConfig")

    def __str__(self):
        return self.name


class ProjectPipelineConfig(models.Model):
    project = models.ForeignKey(Project, on_delete=models.CASCADE)
    pipeline = models.ForeignKey(Pipeline, on_delete=models.CASCADE)
    date_added = models.DateField()
    enabled = models.BooleanField()
    default_parameters = models.JsonField()

ProjectOne.pipelines.all()

config = ProjectPipelineRelationship.objects.get(pipeline=343, project=232)

pipelines_active_for_project =  Pipeline.objects.filter(
...    project=123, project_pipeline_config__enabled=True
... )

https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships

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

No branches or pull requests

2 participants