Skip to content

Conversation

@smehboub
Copy link
Contributor

Hello,

When we execute :

slo-generator api -c config.yaml --target test

We get the error :

Traceback (most recent call last):
  File "/home/test/.local/bin/slo-generator", line 8, in <module>
    sys.exit(main())
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/test/.local/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/test/.local/lib/python3.7/site-packages/slo_generator/cli.py", line 182, in api
    port=port,
  File "/home/test/.local/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/test/.local/lib/python3.7/site-packages/functions_framework/_cli.py", line 37, in _cli
    app = create_app(target, source, signature_type)
  File "/home/test/.local/lib/python3.7/site-packages/functions_framework/__init__.py", line 293, in create_app
    function = _function_registry.get_user_function(source, source_module, target)
  File "/home/test/.local/lib/python3.7/site-packages/functions_framework/_function_registry.py", line 48, in get_user_function
    source=source, target=target, non_target_functions=non_target_functions
functions_framework.exceptions.MissingTargetException: File /home/test/.local/lib/python3.7/site-packages/slo_generator/api/main.py is expected to contain a function named 'test'. Found: 'compute', 'convert_json', 'export', 'get_exporters', 'jsonify', 'load_config', 'make_response', 'process_batch_req', 'process_req', 'run_compute', 'run_export', 'setup_logging' instead

It is better to validate the value of the --target parameter as you already do with the --signature-type parameter, here : https://github.com/google/slo-generator/blob/master/slo_generator/cli.py#L148

Thanks in advance for feedbacks.
Rgs,

@smehboub smehboub changed the title fix: restrict to a choice of a list of values the --target option in api command fix: restrict to a choice of a list of values the --target option in api command Jan 28, 2023
@smehboub
Copy link
Contributor Author

Hello @lvaylet

Any news please ?

Thanks in advance.
Rgs,

Sophian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant