Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action types are not translated during the action call #862

Open
YevheniiSemendiak opened this issue Jun 15, 2022 · 0 comments
Open

Action types are not translated during the action call #862

YevheniiSemendiak opened this issue Jun 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@YevheniiSemendiak
Copy link
Collaborator

If one set an input type other than str, this input cannot be used during the action call, since it gets converted to a string.
Example:

live.yaml:

kind: live

jobs:
  test:
    action: ws:action.yaml
    args:
      some_input: 14

action.yaml:

kind: live

inputs:
  some_input:
    default: 12
    type: int

job:
  image: ubuntu
  bash: |
    echo ${{ inputs.some_input }}

result: ERROR: Type of argument 'some_input' do not match to with inputs declared type. Argument has type 'str', declared input type is 'int'

traceback
nf run test
ERROR: Type of argument 'some_input' do not match to with inputs declared type. Argument has type 'str', declared input type is 'int'
  in "/Users/ysem/work/projects/TMP/action_imputs/.neuro/live.yaml", line 7, column 19
Traceback (most recent call last):
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/cli/main.py", line 210, in main
    cli.main(args=args, standalone_mode=False)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/click/decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/cli/utils.py", line 40, in wrapper
    return runner.run(callback(*args, **kwargs))
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_cli/asyncio_utils.py", line 53, in run
    return self._loop.run_until_complete(main_task)
  File "/Users/ysem/miniconda3/envs/neuro/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/cli/live.py", line 77, in run
    await runner.run(
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/live_runner.py", line 376, in run
    job = await self.flow.get_job(job_id, params)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/context.py", line 1414, in get_job
    return await self._get_job(ctx, ctx.env, self._defaults, job_id)
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/context.py", line 1450, in _get_job
    inputs=await setup_inputs_ctx(ctx, job, action_ast.inputs),
  File "/Users/ysem/.local/pipx/venvs/neuro-all/lib/python3.9/site-packages/neuro_flow/context.py", line 1065, in setup_inputs_ctx
    raise EvalError(
neuro_flow.expr.EvalError: Type of argument 'some_input' do not match to with inputs declared type. Argument has type 'str', declared input type is 'int'
  in "/Users/ysem/work/projects/TMP/action_imputs/.neuro/live.yaml", line 7, column 19

Note: As a step further, It would be cool if neuro-flow could imply the input type if none is specified from the default value. This information is available from yaml.

For instance:

kind: live

inputs:
  first: 12
  second: true
  third: 123.5
  fourth: abracadabra

Input types would be int, bool, float, and string respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant