https://flyte.org logo
#flytekit
Title
# flytekit
j

Jay Ganbat

05/26/2022, 10:04 PM
Hi all, so in previous flytekit i was able to get the workflow version by using this command
Copy code
from flytekit.configuration import internal as flyte_internal

"workflow_version": flyte_internal.VERSION.get(),
this will give me the registered workflow version but looks like the 1.0.x update removed that field, is there any other place i can get this information inside the task
k

Ketan (kumare3)

05/26/2022, 10:13 PM
why do you want this inside the task?
j

Jay Ganbat

05/26/2022, 10:14 PM
im logging the workflow version in a separate json file
execution params has most information
i think it is easy to add the version
cc @Eduardo Apolinario (eapolinario) / @Yee
j

Jay Ganbat

05/26/2022, 10:20 PM
ohh nice, so it is set as env variable
k

Ketan (kumare3)

05/26/2022, 10:20 PM
ya but we trie to send everything in execution_params
please dont use env var
this will help us do a lot of cool optimziations in the future
j

Jay Ganbat

05/26/2022, 10:20 PM
execution_param? so where would that be imported from
is it in the current_context
k

Ketan (kumare3)

05/26/2022, 10:21 PM
yup
j

Jay Ganbat

05/26/2022, 10:36 PM
is there a doc on the available attributes, i tried accessing the attrs field but getting an error 😞
Copy code
handle.write(str(current_context().attrs) + "\n")
      File "/fn/lib/python3.9/site-packages/flytekit/core/context_manager.py", line 261, in __getattr__
        raise AssertionError(f"{attr_name} not available as a parameter in Flyte context - are you in right task-type?")
k

Ketan (kumare3)

05/26/2022, 10:43 PM
attrs are dynamic attributes and are plugin dependent
you want workflow version
that does not exist
only task version does
j

Jay Ganbat

05/26/2022, 10:45 PM
ok so to get the task version it should be something liek this right
Copy code
current_context().get("flyte_internal_task_version")
i tried bunch of them but none of them seem to exist
Copy code
flyte_internal_task_version
flyte_task_version
task_version
version
y

Yee

05/26/2022, 11:37 PM
hey
what’s
current_context
?
like how did you import that?
j

Jay Ganbat

05/26/2022, 11:40 PM
I used ‘from flytekit import current_context’
y

Yee

05/26/2022, 11:43 PM
k
so that will give you the
ExecutionParameters
object
ketan was actually just referring to the environment variables… which will need to be in all-caps. those variables are not in the object itself yet.
incidentally i was just working on this PR yesterday
so after this it will be in that object, under the
task_id
property
👍 1
this will go out at 1.1.0
j

Jay Ganbat

05/26/2022, 11:45 PM
Oh I see so it's not there yet gotcha
Yeah I'm testing out the 1.0 version now, when do you think 1.1 would be out
k

Ketan (kumare3)

05/26/2022, 11:48 PM
Ya lets not use env vars please
👍 1
😆 1
y

Yee

05/26/2022, 11:54 PM
soon… in the next couple of weeks?
i think we’re still trying to stick to our mostly monthly cadence.
👍 1
j

Jay Ganbat

05/26/2022, 11:57 PM
Great thank you 🙏
j

jeev

05/27/2022, 4:21 PM
thanks @Ketan (kumare3) and @Yee!
54 Views