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

Run boefje once at creation or update of ooi #3879

Open
jpbruinsslot opened this issue Nov 25, 2024 · 7 comments · May be fixed by #3906
Open

Run boefje once at creation or update of ooi #3879

jpbruinsslot opened this issue Nov 25, 2024 · 7 comments · May be fixed by #3906
Assignees
Labels
mula Issues related to the scheduler

Comments

@jpbruinsslot
Copy link
Contributor

jpbruinsslot commented Nov 25, 2024

Dit boefje maar 1 keer draaien bij de create van een ooi, of eventueel als tweede spoor, dit boefje alleen draaien als het OOI veranderd. @underdarknl

From the scheduler we need to differentiate what types of boefje requires a different approach for calculating the next time a task needs to run or to run once. Likely we need to update the boefje definition in order to give the scheduler the necessary information on how to schedule the task.

@jpbruinsslot jpbruinsslot added the mula Issues related to the scheduler label Nov 25, 2024
@jpbruinsslot jpbruinsslot self-assigned this Nov 25, 2024
@jpbruinsslot jpbruinsslot added this to KAT Nov 25, 2024
@github-project-automation github-project-automation bot moved this to Incoming features / Need assessment in KAT Nov 25, 2024
@jpbruinsslot jpbruinsslot moved this from Incoming features / Need assessment to In Progress in KAT Nov 25, 2024
@jpbruinsslot
Copy link
Contributor Author

@underdarknl could you work out the requirements for this feature request and the likely scenarios?

@jpbruinsslot jpbruinsslot moved this from In Progress to Approved features / Need refinement in KAT Nov 25, 2024
@underdarknl
Copy link
Contributor

@jpbruinsslot I agree we should add this as a flag to the boefjes definition if needed.
I propose the following options for a boefje:

  • Interval (as already implemented, and the default scheduling strategy)
  • Creation (indicated by a new flag in the boefjes definition runon: creation)
  • Update (indicated by a new flag in the boefjes definition runon: update)

Deletion is never cause for a boefje to run, and neither are reads.
If the runon flag is present, the interval could be implemented as a delay, but I'd rather not overload that field, and instead just ignore it. We could present a warning to the user if both fields are set to explain the behavior for a given Boefje.

@underdarknl
Copy link
Contributor

The likely usecase would be to run a boefje Once on every create/update to make sure we gather static data from a remote source, or send the OOI to a remote sink when we create/Update it in KAT. An alerting boefje that sends out the OOI 'as it happens' would be our first user of this feature.

@jpbruinsslot
Copy link
Contributor Author

@underdarknl

So to recap:

  • on a scan profile mutation event CREATE , or UPDATE and a boefje is NOT indicated to run once > a schedule should be created for this task such that this task will run more often
  • on a scan profile mutation event CREATE and a boefje is indicated that is should only run once ONLY on creation for the ooi that this boefje can run on > the task should only be executed once and no schedule should be created
  • on a scan profile mutation event UPDATE and a boefje is indicated that is should only run once ONLY on update for the ooi that this boefje can run on > the task should only be executed once and no schedule should be created

@jpbruinsslot
Copy link
Contributor Author

jpbruinsslot commented Nov 28, 2024

mutation operation type boefje runon create schedule? run task?
CREATE ["create"] false true
CREATE ["create", "update"] false true
CREATE ["update"] false false
CREATE None true true
UPDATE ["create"] false false
UPDATE ["create", "update"] false true
UPDATE ["update"] false true
UPDATE None true true

@jpbruinsslot jpbruinsslot linked a pull request Nov 28, 2024 that will close this issue
9 tasks
@jpbruinsslot jpbruinsslot moved this from Approved features / Need refinement to In Progress in KAT Nov 28, 2024
@jpbruinsslot jpbruinsslot linked a pull request Nov 28, 2024 that will close this issue
9 tasks
@jpbruinsslot
Copy link
Contributor Author

PR #3906 is updated and can be tested with #3901

Note that tests haven't been written yet.

@jpbruinsslot
Copy link
Contributor Author

Tests have been added to the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mula Issues related to the scheduler
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants