Skip to content

Adjust Shutdown States#421

Merged
wtgee merged 11 commits intopanoptes:developfrom
wtgee:fix-shutdown-states
Jan 30, 2018
Merged

Adjust Shutdown States#421
wtgee merged 11 commits intopanoptes:developfrom
wtgee:fix-shutdown-states

Conversation

@wtgee
Copy link
Copy Markdown
Member

@wtgee wtgee commented Jan 28, 2018

Change the routing on the shutdown states so that the housekeeping state is only entered when actually shutting down for the day. This means the unit can wait in the parked state if no immediate observations are found but if otherwise safe. If it's daytime after waiting then go to housekeeping. If it's bad weather wait another 30 minutes. Otherwise try to observe again.

  • Add route from parked to ready
  • Remove route from housekeeping to ready
  • Return value for power_down

* Add route from `parked` to `ready`
* Remove route from `housekeeping` to `ready`
* Return value for `power_down`
@wtgee wtgee requested a review from jamessynge January 28, 2018 00:41
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 28, 2018

Codecov Report

Merging #421 into develop will decrease coverage by 0.03%.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #421      +/-   ##
===========================================
- Coverage    69.24%   69.21%   -0.04%     
===========================================
  Files           60       60              
  Lines         4806     4817      +11     
  Branches       665      670       +5     
===========================================
+ Hits          3328     3334       +6     
- Misses        1301     1306       +5     
  Partials       177      177
Impacted Files Coverage Δ
pocs/core.py 80.63% <100%> (+0.31%) ⬆️
pocs/state/states/default/parked.py 67.74% <33.33%> (-7.26%) ⬇️
pocs/utils/images/__init__.py 83.05% <0%> (-0.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c2cc1b...00513be. Read the comment docs.

Copy link
Copy Markdown
Contributor

@jamessynge jamessynge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain WHY these changes are being made?

Comment thread pocs/core.py Outdated
self._connected = False
self.logger.info("Power down complete")

return self.connected is False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return this value. It looks like it can not ever return False.

Comment thread pocs/tests/test_pocs.py Outdated
# be ready
assert pocs.goto_next_state()
assert pocs.state == 'ready'
assert pocs.power_down()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the POCS.power_down() change, perhaps change this to:

    pocs.power_down()
    assert not pocs.connected

@wtgee
Copy link
Copy Markdown
Member Author

wtgee commented Jan 28, 2018

@jamessynge Adjusted the PR message for explanation but also changed a bit of the logic and added a better test, PTAL.

Copy link
Copy Markdown
Contributor

@jamessynge jamessynge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to keep things moving, but concerns raised for the long-term.

pocs.next_state = 'housekeeping'
else:
pocs.say("No observations found.")
# TODO Should check if we are close to morning and if so do some morning
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, I've infected you with adding TODOs! ;-)

I'd love a similar behavior at the start of the evening (i.e. evening flats, or darks while the dome is closed).

Comment thread pocs/state/states/default/parked.py Outdated

pocs.reset_observing_run()
pocs.next_state = 'ready'
# We might have shutdown in long wait
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"we might have shutdown during that sleep."

Comment thread pocs/tests/test_pocs.py
assert pocs_process.is_alive() is False


def test_pocs_park_to_ready_with_obs(pocs):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried that some of these states are getting too complex. Let's have a further discussion about how to address that (e.g. multiple state machines, either nested or parallel).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this made the parked state a bit obtuse with all the if-branching.

@wtgee wtgee merged commit 4d52bc9 into panoptes:develop Jan 30, 2018
@wtgee wtgee deleted the fix-shutdown-states branch January 30, 2018 03:32
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.

2 participants