Search code examples
python-3.xazure-eventhubazure-databricks

Run a cell "in continuous" in a databricks notebook


Since eventhubs receiver stops listening after a timeout without new event, I want to run a specific cell (paragraph) in a azure databricks notebook from another cell in the same notebook using python. I need to run this cell every time it completes after a timeout. It's like simulating a continuous running.


Solution

  • Finally, I use a while True statement and in the statement I put the code I want to run. Thank you guys –

    currentMessage = receiver.receive(timeout=600)
    while True:
       for event_data in currentMessage:
            .......
            .......
            .......
        currentMessage = receiver.receive(timeout=600)
        print("end processing after timeout")