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

Adapt scheduled tasks to work with workflows #234

Open
Tracked by #39
scott-taubman opened this issue Feb 28, 2023 · 1 comment
Open
Tracked by #39

Adapt scheduled tasks to work with workflows #234

scott-taubman opened this issue Feb 28, 2023 · 1 comment
Assignees
Labels
backend Related to the django backend

Comments

@scott-taubman
Copy link
Contributor

scott-taubman commented Feb 28, 2023

Scheduled tasks currently only work with Functions, but we also want them to support workflows. In order to do this, we'll want to move away from having a direct foreign key to Function on the ScheduledTask model and instead have a more general foreign key setup (separately record the id and model of the related object).

Django's contenttypes framework, and specifically the GenericForeignKey seem designed for this exact scenario. We should look to utilize that as our primary option. If that doesn't work out, implementing a similar concept manually should be pretty straightforward.

In addition to the model changes, the the run_scheduled_task function in core/utils/tasking.py will need to be updated so that it creates either a WorkflowRun or a Task depending on the related object of the ScheduledTask. Alternatively, there's an argument to be made that we should perhaps drop the concept of a WorkflowRun and instead apply this same generic relation concept to Task, where a Task could be either a single function execution or a workflow execution. This approach has several benefits, such as making it much easier to show function and workflow executions in a single, ordered list to get a full picture of all activity. This should be discussed and a separate issue opened as appropriate before proceeding with work on this issue.

@scott-taubman scott-taubman mentioned this issue Feb 28, 2023
46 tasks
@scott-taubman scott-taubman added backend Related to the django backend needs discussion Discussion required to make decisions or gain clarity before proceeding labels Feb 28, 2023
@scott-taubman
Copy link
Contributor Author

After discussion we are going to pursue the WorkflowRun and Task consolidation, which is now tracked in #242. We should complete that before proceeding with this issue.

@scott-taubman scott-taubman removed the needs discussion Discussion required to make decisions or gain clarity before proceeding label Mar 6, 2023
@kvig kvig self-assigned this Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to the django backend
Projects
None yet
Development

No branches or pull requests

2 participants