sticky-angle-28419
03/13/2023, 2:59 PMTypeError: 'Promise' object is not subscriptable
since flyte creates promises during packaging/deployment:
@workflow
def wf(wf_args) -> int:
print(wf_args["x"])
...
rapid-vegetable-16315
03/13/2023, 4:50 PMwf_args["x"]
without issues since that's where the actual Python code runs, and the inputs are deserialized by then.rapid-vegetable-16315
03/13/2023, 4:51 PM@task
def task(wf_args):
print(wf_args["x"])
@workflow
def workflow(wf_args):
task(wf_args)
sticky-angle-28419
03/13/2023, 4:51 PMsticky-angle-28419
03/13/2023, 4:52 PMsticky-angle-28419
03/13/2023, 4:53 PMrapid-vegetable-16315
03/13/2023, 4:53 PMflytekit.current_context().execution_id
should do the tricksticky-angle-28419
03/13/2023, 4:53 PMrapid-vegetable-16315
03/13/2023, 4:53 PMsticky-angle-28419
03/13/2023, 4:53 PMsticky-angle-28419
03/13/2023, 4:53 PMsticky-angle-28419
03/13/2023, 4:53 PMrapid-vegetable-16315
03/13/2023, 4:53 PMrapid-vegetable-16315
03/13/2023, 4:54 PMsticky-angle-28419
03/13/2023, 4:54 PMwith
context to wrap tasks, but with that would like to send in the execution id to match my experiment run idsticky-angle-28419
03/13/2023, 4:55 PMsticky-angle-28419
03/13/2023, 4:56 PM@workflow
def wf(wf_args):
with logger.run(run_id=1) as run:
task1()
sticky-angle-28419
03/13/2023, 4:56 PMrapid-vegetable-16315
03/13/2023, 4:57 PMsticky-angle-28419
03/13/2023, 4:58 PMsticky-angle-28419
03/13/2023, 4:58 PM@workflow
def wf(wf_args):
with logger.run(run_id=1) as run:
task1_o = task1()
task2_o = task2(x=task1_o)
...
sticky-angle-28419
03/13/2023, 4:59 PMsticky-angle-28419
03/13/2023, 4:59 PMwith
outside of the @workflow
?sticky-angle-28419
03/13/2023, 4:59 PMsticky-angle-28419
03/13/2023, 5:00 PMrapid-vegetable-16315
03/13/2023, 5:00 PM@dynamic
def my_experiment(wf_args):
with logger.run(run_id=flytekit.current_context().execution_id) as run:
task1_o = task1(wf_args)
task2_o = task2(x=task1_o)
...
@workflow
def wf(wf_args):
my_experiment(wf_args)
sticky-angle-28419
03/13/2023, 5:01 PM@dynamic
doessticky-angle-28419
03/13/2023, 5:01 PMrapid-vegetable-16315
03/13/2023, 5:02 PMrapid-vegetable-16315
03/13/2023, 5:03 PMsticky-angle-28419
03/13/2023, 5:05 PMrapid-vegetable-16315
03/13/2023, 5:14 PMsticky-angle-28419
03/13/2023, 5:16 PM