Andreas Nord
11/28/2022, 11:09 AMSecret.load("secret")
this was working on Prefect 1 but on 2 I get this error:
RuntimeError: A 'sync_compatible' method was called from a context that was previously async but is now sync. The sync call must be changed to run in a worker thread to support sending the coroutine for 'load' to the main thread.
Any ideas? ThanksJames Sopkin
11/28/2022, 3:37 PMAndreas Nord
11/28/2022, 3:39 PMJames Sopkin
11/28/2022, 4:00 PMtask_a
I imported in my example
@task
def taska(a: int):
secret_block = Secret.load("my-secret")
print(a + 1)
print(secret_block.get())
Andreas Nord
11/28/2022, 4:06 PMJames Sopkin
11/28/2022, 4:08 PMAndreas Nord
11/28/2022, 4:37 PMJames Sopkin
11/28/2022, 4:56 PMfrom prefect import task
@task
def taska(a: int, secret: str):
print(a + 1)
print(secret.get())
@task
def taskb(secret: str):
print(secret.get()[::-1])
from prefect import flow, task
from flow_file import taska, taskb
from prefect.blocks.system import Secret
@flow()
def myflow():
secret = Secret.load("my-secret")
taska(5, secret) # prints x + 1 and prints secret block
taskb(secret) # prints secret in reverse
myflow()