Adam Roderick
03/05/2020, 11:17 PMException raised while calling state handlers: TypeError('string indices must be integers')
. I don't really now how to begin troubleshooting this in cloud. Any ideas?Chris White
03/05/2020, 11:20 PMx = [1, 2, 3]
x["0"]
# TypeError: list indices must be integers or slices, not str
There are two paths forward:Adam Roderick
03/05/2020, 11:22 PMjira = { server = "<https://datateer.atlassian.net/>", project = "DSD" }
Chris White
03/05/2020, 11:24 PMPREFECT__CONTEXT__SECRETS__NAME="foo"
). You can provide these environment variables to your agent with the -e
flag and your agent will then provide this env var to each flow run it submits. This sometimes allows for easier debugging.
2.) You can see what value your Cloud Secret is returning by doing the following:
- start a python session with local secrets turned off:
PREFECT__CLOUD__USE_LOCAL_SECRETS=false ipython
- load your secret locally to see what is being returned:
from prefect.client.secrets import Secret
Secret("my_secret").get()
Adam Roderick
03/05/2020, 11:28 PMChris White
03/05/2020, 11:32 PMAdam Roderick
03/06/2020, 12:01 AMChris White
03/06/2020, 12:07 AMAdam Roderick
03/06/2020, 12:07 AMChris White
03/06/2020, 12:08 AMAdam Roderick
03/06/2020, 12:11 AMChris White
03/06/2020, 12:14 AMAdam Roderick
03/06/2020, 12:14 AMChris White
03/06/2020, 12:14 AMAdam Roderick
03/06/2020, 12:14 AMChris White
03/06/2020, 12:14 AMAdam Roderick
03/06/2020, 1:32 AMname = {prop = "value"}
. Because this was valid TOML syntax, it loaded as a dict and I was able to use my secret like this name["prop"]
But in Cloud, the secrets are not stored in a .toml file, they are stored as strings. So my secret loaded in as a string, and name["prop"]
failed.
I changed my local secret to be a JSON string in the TOML file. name = '{"prop": "value"}'
, and ensured the same format was in my Cloud secret. Both local and cloud now load consistently as a dict.
Cloud logging did not give me the detail I needed--I needed a full traceback to clue me in to what line was failing. By building my docker container locally and running an interactive session, then starting a python session and running flow.run()
, I was able to see the full traceback.
Thanks much @Chris White for helping troubleshoot thisChris White
03/06/2020, 1:33 AMMarvin
03/06/2020, 1:35 AM