icy-tent-98067
05/02/2024, 3:13 PMpydantic
class Hyperparameters
. However, in order to optimize the caching of my pipeline I may sometimes need to extract out individual hyperparameter values so that I do not input ones that I do not need. By doing so, I can improve the chances of a "cache hit". However, this means that in practice I have dozens of small tasks that are nothing more than as follows:
@task
def get_batch_size(params: Hyperparameters) -> int:
return params.batch_size
There are other types of so-called lambda-tasks that I utilize for more operations, such as collecting the outputs from a map-task or creating a clean list
in order to use a map-task.
I guess my real question is this: Is there a way to support lambda functions to create a task? Would such functionality even possible to implement in the DSL?
I suppose I would like to be able to create a workflow with something like this:
@workflow
def workflow(params: Hyperparameters):
batch_size = task(lambda params: params.batch_size)
do_something_with_batch_size(batch_size=batch_size)
rich-garden-69988
05/03/2024, 2:10 AMicy-tent-98067
05/03/2024, 2:24 AMrich-garden-69988
05/03/2024, 4:11 PMAnnotated
and write your own HashMethod
https://github.com/flyteorg/flytekit/blob/8d258c48b64bce26c66d79dc7e0c1c9a000d73b9/flytekit/core/hash.py#L11rich-garden-69988
05/03/2024, 4:12 PMicy-tent-98067
05/09/2024, 2:57 PM