thoth-station / adviser

The recommendation engine for Python software stacks and Dependency Monkey in project Thoth.
https://thoth-station.github.io
GNU General Public License v3.0
34 stars 13 forks source link

Provide "eager exploitation" when the resolution is about to time out #1526

Closed fridex closed 3 years ago

fridex commented 3 years ago

Is your feature request related to a problem? Please describe.

When resolving larger stacks, it might happen that the resolution process does not reach exploitation phase for reinforcement learning algorithms as the temperature is decreasing slowly. To workaround this, it might be good to explicitly switch to exploitation phase once before the resolver is shut down gracefully by a signal in deployment.

Describe the solution you'd like

As of now, we send one signal signalizing the resolution process should stop after the given timeout in the liveness probe:

https://github.com/thoth-station/adviser/blob/4d4eb9b5c75b709ef895cb37d7109abf8912ba2b/liveness.py#L49-L50

We could configure the liveness probe to send one signal (send after initialDelaySeconds configured from the liveness probe) which will turn the predictor into the exploitation phase (signalizing the resolution will soon finish) and the second signal (configured based on periodSeconds) would cause the resolver to halt and report the highest rated stack. This way we would not end with a highly rated stack not yet resolved in beam as the resolution process can find a better candidate:

Pipeline reached 2507 final states out of 100000 requested in iteration 52919 (pipeline pace 4.16 stacks/second); top rated software stack in beam has a score of 8.50; top rated software stack found so far has a score of 3.50
fridex commented 3 years ago

An example - predictor can react to SIGUSR1 (turn into exploitation phase) and resolver to SIGINT to halt the resolution process.