<#4821 [Core feature] Access decorator attributes ...
# flytekit
a
#4821 [Core feature] Access decorator attributes from within the task definition Issue created by pryce-turner ### Motivation: Why do you think this is important? Being able to access attributes passed to the task decorator (e.g. CPU requests/limits) from within the task definition itself would enable more sophisticated tasks. For example, if you're running on with x threads you can pass that information to the threading parameter of the tool being called by a ShellTask. You could also have a benchmarking workflow with a number of different configs that are all automatically compiled into a report alongside the run statistics. ### Goal: What should the final outcome look like, ideally?
Copy code
from flytekit import current_context

num_cpu = current_context.task_config['resources']['cpu']
### Describe alternatives you've considered These things could be recorded manually but this is much more dynamic. It's possible to access these properties now but there's no easy way to do it. ### Propose: Link/Inline OR Additional context No response ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte