Miksus / rocketry

Modern scheduling library for Python
https://rocketry.readthedocs.io
MIT License
3.26k stars 105 forks source link

ENH: Pass parameters for manual run #99

Closed Miksus closed 1 year ago

Miksus commented 2 years ago

Is your feature request related to a problem? Please describe. When running a task manually (using force_run), sometimes it's useful to pass parameters for this particular manual run.

Describe the solution you'd like Possibly a core change. An attribute manual_parameters or so that are used only once and only when the task is run with force_run.

Describe alternatives you've considered Cannot think of such.

Miksus commented 1 year ago

This is already implemented and will be in v2.4.0:

@app.task()
def mytask(x, y):
    ...

task = app.session["mytask"]
task.run(x=5, y="value")

task.run will set the task to the run queue of the task (called batches) which the scheduler will pick when it has time. The parameters supplied to the method will override all others that overlap.