Vikram Thirumalai
04/28/2021, 4:36 PMCaused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002C254411C10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
Kevin Kho
Vikram Thirumalai
04/28/2021, 4:39 PMKevin Kho
Kevin Kho
slack_notifier
?Kevin Kho
Vikram Thirumalai
04/28/2021, 4:43 PMfrom prefect import Flow, task
from prefect.utilities.notifications import slack_notifier
from prefect.engine.state import Failed
from prefect.client.secrets import Secret
@task(name="1/x task", state_handlers=[slack_notifier])
def div():
return 1 / 1
@task(name="Add 1 task", state_handlers=[slack_notifier])
def add(x):
return x + 1
with Flow('Add Divide Flow') as f:
res = div()
print(res)
final_state = f.run()
Vikram Thirumalai
04/28/2021, 4:43 PMVikram Thirumalai
04/28/2021, 4:44 PMKevin Kho
Vikram Thirumalai
04/28/2021, 5:03 PMKevin Kho
context.secrets
in the config.toml
? What version of Prefect are you on?Kevin Kho
slack_notifier
wrong in the code.Kevin Kho
handler
and passing the handler
to @task
like follows:
from prefect.utilities.notifications import slack_notifier
handler = slack_notifier(only_states=[Failed]) # we can call it early
@task(state_handlers=[handler])
def add(x, y):
return x + y
Kevin Kho
Vikram Thirumalai
04/28/2021, 5:09 PMhandler = slack_notifier()
@task(name="1/x task", state_handlers=[handler])
def div():
return 1 / 1
@task(name="Add 1 task", state_handlers=[slack_notifier])
def add(x):
return x + 1
with Flow('Add Divide Flow') as f:
res = div()
print(res)
final_state = f.run()
this is what i changed my snippet to and it looks like im still getting the same error as aboveVikram Thirumalai
04/28/2021, 5:10 PMKevin Kho
slack_notifier
Vikram Thirumalai
04/28/2021, 5:11 PM@task(name="Add 1 task", state_handlers=[handler])
def add(x):
return x + 1
Kevin Kho
Vikram Thirumalai
04/28/2021, 5:14 PMKevin Kho
Vikram Thirumalai
04/28/2021, 5:16 PMKevin Kho
config.toml
?Kevin Kho
Kevin Kho
from prefect import Flow, task
from prefect.utilities.notifications import slack_notifier
from prefect.engine.state import Failed
from prefect.client.secrets import Secret
handler = slack_notifier()
@task(name="1/x task", state_handlers=[handler])
def div():
return 1 / 1
@task(name="Add 1 task", state_handlers=[handler])
def add(x):
return x + 1
with Flow('Add Divide Flow') as f:
res = div()
print(res)
final_state = f.run()
Kevin Kho
Vikram Thirumalai
04/28/2021, 5:20 PMKevin Kho
import prefect
x = prefect.context.secrets.get("SLACK_WEBHOOK_URL")
print(x)
Kevin Kho
Vikram Thirumalai
04/28/2021, 5:29 PMKevin Kho
Kevin Kho
Vikram Thirumalai
04/28/2021, 5:34 PMVikram Thirumalai
04/28/2021, 6:05 PMKevin Kho
flow.run()
. The doesn’t use cloud/server as a backend. It just runs on local.