save_to_df testing
This commit is contained in:
@@ -640,10 +640,10 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
st.write(raw_response_text)
|
||||
|
||||
try:
|
||||
result_db_store = save_to_sf('load_training_results', training_results_file_name = "results.csv", attempt_logs_file_name = "history.csv")
|
||||
st.write(result_db_store)
|
||||
except Exception as e:
|
||||
st.write(e)
|
||||
results = save_to_sf('load_training_results', "training_results_file_name", "attempt_logs_file_name", "results.csv", "history.csv")
|
||||
st.write(results)
|
||||
except:
|
||||
st.write("running locally")
|
||||
|
||||
else:
|
||||
st.write("Access Denied")
|
||||
|
||||
@@ -9,7 +9,6 @@ import http.client
|
||||
import base64
|
||||
import ast
|
||||
import snowflake.connector
|
||||
import json
|
||||
|
||||
|
||||
def get_secret():
|
||||
@@ -40,8 +39,7 @@ def get_secret():
|
||||
|
||||
# TODO: This function needs to be changed to accept Kwargs
|
||||
# The function name should be more generic and cofnigurable
|
||||
# def save_to_sf(dag_name, conf_1, conf_2, training_results_file, attempt_logs_file):
|
||||
def save_to_sf(dag_name, **kwargs):
|
||||
def save_to_sf(dag_name, conf_1, conf_2, training_results_file, attempt_logs_file):
|
||||
|
||||
mwaa_env_name = 'doczy-dev-infra-mwaa'
|
||||
dag_name = dag_name
|
||||
@@ -65,11 +63,10 @@ def save_to_sf(dag_name, **kwargs):
|
||||
# conf = "{\"" + "training_results_file_name" + "\":\"" + {training_results_file} + "\", \"" + "attempt_logs_file_name" + "\":\"" + {attempt_logs_file} + "\"}".format(training_results_file=training_results_file, attempt_logs_file=attempt_logs_file)
|
||||
|
||||
conf = f"""{{
|
||||
"{list(kwargs.keys())[0]}": "{list(kwargs.values())[0]}",
|
||||
"{list(kwargs.keys())[1]}": "{list(kwargs.values())[1]}"
|
||||
}}"""
|
||||
"{conf_1}": "{training_results_file}",
|
||||
"{conf_2}": "{attempt_logs_file}"
|
||||
}}"""
|
||||
|
||||
conf1 = json.dumps(kwargs)
|
||||
|
||||
payload = mwaa_cli_command + " " + dag_name + " --conf '{}'".format(conf)
|
||||
headers = {
|
||||
@@ -81,7 +78,7 @@ def save_to_sf(dag_name, **kwargs):
|
||||
data = res.read()
|
||||
dict_str = data.decode("UTF-8")
|
||||
mydata = ast.literal_eval(dict_str)
|
||||
return str(conf) + str(conf1)
|
||||
return payload
|
||||
|
||||
|
||||
# save_to_sf("2024-03-13T17-36_prompt_results.csv", "2024-03-14T23-19_history.csv")
|
||||
|
||||
Reference in New Issue
Block a user