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

cli add schedule for-storage not working in toy example #588

Closed
Daan4 opened this issue Feb 3, 2023 · 3 comments · Fixed by #589
Closed

cli add schedule for-storage not working in toy example #588

Daan4 opened this issue Feb 3, 2023 · 3 comments · Fixed by #589
Labels
bug Something isn't working CLI

Comments

@Daan4
Copy link

Daan4 commented Feb 3, 2023

Following the toy example the last step to make a schedule fails with an exception using the latest docker image.

flexmeasures add schedule for-storage --sensor-id 2 --consumption-price-sensor 3 \
    --start ${TOMORROW}T07:00+01:00 --duration PT12H \
    --soc-at-start 50% --roundtrip-efficiency 90%

gives

Traceback (most recent call last):
  File "/usr/local/bin/flexmeasures", line 8, in <module>
    sys.exit(flexmeasures_cli())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 579, in main
    return super().main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 427, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/flexmeasures/cli/data_add.py", line 1026, in add_schedule_for_storage
    success = make_schedule(**scheduling_kwargs)
TypeError: make_schedule() got an unexpected keyword argument 'sensor'

The issue seems to be that in data_add.py the kw sensor is passed to make_schedule by add_schedule_for_storage, while make_schedule expects an id.

@nhoening
Copy link
Contributor

nhoening commented Feb 4, 2023

Thanks for reporting @Daan4!

I'll test this locally and get back to you. This should have been caught in our release Q&A.

@nhoening
Copy link
Contributor

nhoening commented Feb 4, 2023

This bug only affects usage without the --as-job parameter. That one is used in the docker-compose tutorial, which is the one our Q&A is testing. We need to test both (or built a test suite around our CLI commands, which is tricky).

When using --as-job, you need a Redis server, which is why we do that in the docker-compose tutorial.

But until we publish the updated Docker image, this is the workaround @Daan4 !

@Flix6x Flix6x added bug Something isn't working CLI labels Feb 4, 2023
@nhoening
Copy link
Contributor

nhoening commented Feb 4, 2023

We released 0.12.2 with this fix included. Thanks for reporting!

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

Successfully merging a pull request may close this issue.

3 participants