Survey banner
The Dataiku Community is moving to a new home! We are temporary in read only mode: LEARN MORE

Invoking library code from webapp isn't working

Level 2
Invoking library code from webapp isn't working


import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
import time

def write_random(name: str):
    sample = dataiku.Dataset(name)
    sample.write_schema([{"name":"data", "type":"double"}])
    with sample.get_continuous_writer("source-id-string-dummy") as sample_writer:
        while True:
            val = np.random.rand()
            sample_writer.write_row_dict({'data': val})


I was trying to run library code (streaming python type) from webapp on a button click but it was giving below error:

webapp lib error.png
even though im able to import and run the same thing just fine in a streaming python type recipie like this:


from continuous_python import write_random



could anyone help me with where I'm going wrong?

0 Kudos
1 Reply

It could be that continuous recipes are not supported within the context of a Dataiku Webapp. I would suggest you raise it with Dataiku Support to confirm. It will be good to know the answer to this one. If that is the case it may be possible (dependong on what you are trying to achieve) to wrap around the code into a Dataiku recipe and execute it from the Webapp like that. I have covered how to start/stop continuous Python recipes using the Python API on this post.