Hi all, so in previous flytekit i was able to get ...
# flytekit
j
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
why do you want this inside the task?
j
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
ohh nice, so it is set as env variable
k
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
execution_param? so where would that be imported from
is it in the current_context
k
yup
j
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
attrs are dynamic attributes and are plugin dependent
you want workflow version
that does not exist
only task version does
j
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
hey
what’s
current_context
?
like how did you import that?
j
I used ‘from flytekit import current_context’
y
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
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
Ya lets not use env vars please
👍 1
😆 1
y
soon… in the next couple of weeks?
i think we’re still trying to stick to our mostly monthly cadence.
👍 1
j
Great thank you 🙏
j
thanks @Ketan (kumare3) and @Yee!
205 Views