Product Update – Task Management at Scale and Invokable Scripts from the Tasks API
By Bharat Bhat / Aug 12, 2022 / InfluxDB, Flux
Thanks to Vinay Kumar for being a key contributor to this article.
We love to write and ship code to help developers bring their ideas and projects to life. That’s why we’re constantly working on improving our product to meet developers where they are, to ensure their happiness, and accelerate Time to Awesome.
This week, we are covering a featured product release that we think will save you time and effort when building with time series, InfluxDB – and specifically – Tasks. Check out the new feature and, with the few steps outlined below, start using it right away!
Manage your InfluxDB Tasks at scale
Tasks can now invoke Scripts and pass variables to these Scripts, greatly increasing your ability to manage, reuse, and scale your code and processes.
An interesting design pattern that we keep seeing is that – even if you have 100s of Tasks – the underlying Flux logic tends to be similar. You may be applying the same logic across different buckets, measurements, or even at different levels of time granularity.
With this new feature, the Flux developers on your team can create Scripts that run a common logic, but provide variable outputs depending on the parameters passed in on Script invocation. Essentially, each Script can be referenced by n unique Tasks which vary in the parameters passed in or in the schedule logic.
So, if the underlying Flux logic needs to be tweaked, simply modifying Script X with the new Flux logic will update all the associated Tasks that call Script X.
Here’s a diagram that visually shows the power of this new feature.
As you can see from the diagram, this will greatly simplify how you manage Tasks at scale.
Here’s a video that walks you through how to create, use, and manage Tasks that invoke Scripts:
Democratize Flux skills in your organization
With the ability to save and run Flux code as Scripts, the power of Flux is now available to all: even developers in your organization who are not Flux experts can now benefit from the complex/efficient Scripts written by the most fluent Flux users in your organization. These Scripts are now reusable, and this model allows you to trigger query logic on-demand from your application to extract critical business value from your time series data.
How do I get started?
Our Docs team have built a great step-by-step guide here with sample code to help you create a Task that references a Script. If you are entirely unfamiliar with InfluxDB Tasks, please start here and return to the aforementioned docs page once you have walked through the basic components of Tasks.
Of course, please reach out to us if you have any specific design or implementation questions. We are always here to help.