Hi team, When I use <flytekit.ContainerTask> with ...
# flytekit
f
Hi team, When I use flytekit.ContainerTask with
environment
param, it throws an error when running
pyflyte
to serialize the worflows
Copy code
Loading packages ['flyte.workflows'] under source root /root
Traceback (most recent call last):
  File "/opt/venv/bin/pyflyte", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/venv/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/clis/sdk_in_container/package.py", line 106, in package
    serialize_and_package(pkgs, serialization_settings, source, output, fast)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/repo.py", line 118, in serialize_and_package
    registrable_entities = serialize(pkgs, settings, source, options=options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/repo.py", line 54, in serialize
   registrable_entities = get_registrable_entities(ctx, options=options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/serialize_helpers.py", line 75, in get_registrable_entities
    get_serializable(new_api_serializable_entities, ctx.serialization_settings, entity, options=options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 581, in get_serializable
    cp_entity = get_serializable_workflow(entity_mapping, settings, entity, options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 226, in get_serializable_workflow
    upstream_node_models = [
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 227, in <listcomp>
    get_serializable(entity_mapping, settings, n, options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 584, in get_serializable
    cp_entity = get_serializable_node(entity_mapping, settings, entity, options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 412, in get_serializable_node
    task_spec = get_serializable(entity_mapping, settings, entity.flyte_entity, options=options)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 578, in get_serializable
    cp_entity = get_serializable_task(entity_mapping, settings, entity)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/tools/translator.py", line 173, in get_serializable_task
    container = entity.get_container(settings)
  File "/opt/venv/lib/python3.8/site-packages/flytekit/core/container_task.py", line 84, in get_container
    env = {**settings.env, **self.environment} if self.environment else settings.env
TypeError: 'NoneType' object is not a mapping
Its hitting a bug here where
settings.env
is null.
y
looking
what’s your gh handle @Fredrick
f
fredrickprashanth
y
this should be fixed btw, just wanted to tag you on the pr
pull flytekit 1.2.0
f
awesome. thank you @Yee for fixing it.
108 Views