Invoking library code from webapp isn't working
Sangavi_M
Registered Posts: 10 ✭✭✭
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}) sample_writer.checkpoint(str(time.time())) time.sleep(1)
I was trying to run library code (streaming python type) from webapp on a button click but it was giving below error:
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 write_random("sample")
could anyone help me with where I'm going wrong?
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,170 Neuron
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.