Spaces:
Runtime error
Runtime error
Showing logs data
Browse files
utils.py
CHANGED
|
@@ -120,10 +120,6 @@ def render_config(config, component, help_str=None, parent_key=None):
|
|
| 120 |
options = [True, False]
|
| 121 |
selected_option = component.radio(f"{prefix}{k}", options, options.index(v))
|
| 122 |
config[k] = bool(selected_option)
|
| 123 |
-
elif k == 'jinja_template':
|
| 124 |
-
config[k] = component.text_area(
|
| 125 |
-
f"{prefix}{k}", v, help="Jinja Template"
|
| 126 |
-
)
|
| 127 |
else:
|
| 128 |
tokens = k.split("_")
|
| 129 |
is_secret = tokens[-1] in ["key", "password", "token", "secret"]
|
|
@@ -142,8 +138,6 @@ def render_config(config, component, help_str=None, parent_key=None):
|
|
| 142 |
|
| 143 |
def generate_python(generate_config):
|
| 144 |
return f"""
|
| 145 |
-
import json
|
| 146 |
-
|
| 147 |
from obsei.configuration import ObseiConfiguration
|
| 148 |
|
| 149 |
# This is Obsei workflow path and filename
|
|
@@ -180,7 +174,7 @@ def generate_yaml(generate_config):
|
|
| 180 |
return yaml.dump(generate_config)
|
| 181 |
|
| 182 |
|
| 183 |
-
def execute_workflow(generate_config, component=None):
|
| 184 |
progress_show = None
|
| 185 |
if component:
|
| 186 |
progress_show = component.empty()
|
|
@@ -198,12 +192,18 @@ def execute_workflow(generate_config, component=None):
|
|
| 198 |
sink = obsei_configuration.initialize_instance("sink")
|
| 199 |
|
| 200 |
source_response_list = source.lookup(source_config)
|
|
|
|
| 201 |
|
| 202 |
analyzer_response_list = analyzer.analyze_input(
|
| 203 |
source_response_list=source_response_list, analyzer_config=analyzer_config
|
| 204 |
)
|
|
|
|
| 205 |
|
| 206 |
sink_response_list = sink.send_data(analyzer_response_list, sink_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
if progress_show:
|
| 209 |
progress_show.code("πππ Processing Complete!! πΎπΎπΎ")
|
|
|
|
| 120 |
options = [True, False]
|
| 121 |
selected_option = component.radio(f"{prefix}{k}", options, options.index(v))
|
| 122 |
config[k] = bool(selected_option)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
else:
|
| 124 |
tokens = k.split("_")
|
| 125 |
is_secret = tokens[-1] in ["key", "password", "token", "secret"]
|
|
|
|
| 138 |
|
| 139 |
def generate_python(generate_config):
|
| 140 |
return f"""
|
|
|
|
|
|
|
| 141 |
from obsei.configuration import ObseiConfiguration
|
| 142 |
|
| 143 |
# This is Obsei workflow path and filename
|
|
|
|
| 174 |
return yaml.dump(generate_config)
|
| 175 |
|
| 176 |
|
| 177 |
+
def execute_workflow(generate_config, component=None, log_components=None):
|
| 178 |
progress_show = None
|
| 179 |
if component:
|
| 180 |
progress_show = component.empty()
|
|
|
|
| 192 |
sink = obsei_configuration.initialize_instance("sink")
|
| 193 |
|
| 194 |
source_response_list = source.lookup(source_config)
|
| 195 |
+
log_components["source"].write([vars(response) for response in source_response_list])
|
| 196 |
|
| 197 |
analyzer_response_list = analyzer.analyze_input(
|
| 198 |
source_response_list=source_response_list, analyzer_config=analyzer_config
|
| 199 |
)
|
| 200 |
+
log_components["analyzer"].write([vars(response) for response in analyzer_response_list])
|
| 201 |
|
| 202 |
sink_response_list = sink.send_data(analyzer_response_list, sink_config)
|
| 203 |
+
if sink_response_list:
|
| 204 |
+
log_components["sink"].write([vars(response) for response in sink_response_list])
|
| 205 |
+
else:
|
| 206 |
+
log_components["sink"].write("No Data")
|
| 207 |
|
| 208 |
if progress_show:
|
| 209 |
progress_show.code("πππ Processing Complete!! πΎπΎπΎ")
|