How can I trigger an InfluxDB "Notebook" to run immediately using python

In the use case of IOT where a machine is running doing a job, I would like to do some computations at the end of the job.
Therefore I have need to trigger a “Task” or a “NoteBook” on an event.(i.e. the end of the “job”)

I can trigger a “Task” from Python using
client.tasks_api().run_manually('xxxxxxxxxxxxxxx')

However, a Task in the InfluxDB 2.0 Cloud interface is not very interactive and so if the flux needs modifying it’s tricky to visualise and debug.

The new NoteBook feature is easier to visualise and debug and so this will be a better place for my more complex queries.

Therefore I need to trigger running a “NoteBook” from Python.
What I need is:
client.**books**_api().run_manually('xxxxxxxxxxxxxxx')

HOW DO I DO THAT PLEASE

I know someone is going to suggest exporting the Notebook as a Task. But the Notebooks feature has assumed some things about a use case.
For example, it assumes that a user would only want to export a Notebook to a Task if they are writing to a new bucket. But what if they want the data returned as a table.

In my case, that’s exactly what I need to do. I want to

  • run some Notebebook as a Task (periodically)
  • run some Notebooks as a Task on an event (e.g. machine cycle has finished)
  • run some Notebooks as a Query (e.g. an AWS Lambda function calls the query and does something with the data)

So Notebooks is a great feature. But there’s potential to open it up to more powerful use-cases.

Hi @asmith,

currently the client doesn’t have the option how to trigger notebook manually.

The influxdb-client-python depends on the API definition but there is no definition for Notebook: InfluxDB Cloud API documentation.

Regards

Hi @asmith , thank you for the suggestions. I think we are on the same page. I believe there are a few things coming down the road that will help you.

  • Task editing will start happening in a Notebook, instead of a separate interface. You’ll be able to preview and debug in the UI.
  • Tasks will be able to be triggered by an event instead of just by cron. In this case, the machine cycle summary could indicate that the follow up task should execute by writing some status to a bucket.
  • More Flux code will be stored in the cloud and executed remotely via http requests. So your client code will look more like client.functions_api.execute(function='my-function', params={'param1':'value'})

I believe the combination of these things will get you to what you are asking for. We will let you know as these capabilities start rolling out.

We are DEFINITELY on the same page!
Yes there is some confusing duplication but I’m really pleased that you’re all on it.

Awesome product by the way!

Remote calling of functions was going to be my next question because it’s a logical extension of where this is going. Very excited to try this all out. It’s exactly what we need.

Is it possible by now to trigger tasks by events?
I couldn’t find anything about this, but maybe that’s just because I was too stupid to search in the right places.

@Anaisdg I just realized @russ_savage hasn’t been online since september 21 and you helped me before. Do you by chance know anything about event-triggered Tasks coming up?
Doing my masters thesis on an InfluxDB-related topic and I would really like to write about this as a coming opportunity