-
Notifications
You must be signed in to change notification settings - Fork 20
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
Change drone state initialisation and notification of plugins #247
Change drone state initialisation and notification of plugins #247
Conversation
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
==========================================
- Coverage 99.39% 99.34% -0.05%
==========================================
Files 54 54
Lines 2144 2145 +1
==========================================
Hits 2131 2131
- Misses 13 14 +1
Continue to review full report at Codecov.
|
@@ -126,26 +126,24 @@ def test_create_composite( | |||
@patch("tardis.resources.poolfactory.BatchSystemAgent") | |||
@patch("tardis.resources.poolfactory.SiteAgent") | |||
def test_create_drone(self, mock_site_agent, mock_batch_system_agent, mock_drone): | |||
self.assertEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not directly related to the reason for the pull request. Instead it fixes a broken unittest. Actually, the test_create_drone
test did not test anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pedantic man strikes again! Request for change! :wq
!
Co-authored-by: Max Fischer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fabulous idea, if I may say so. 🧐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Currently, newly created drones are initialised with
state=RequestState()
. Plugins like theSqliteRegistry
will be notified on the first state changeRequestState
->BootingState
. As a consequence, theSqliteRegistry
is inserting the Drone on the change toBootingState
. Sometimes the first startup of a Drone is not successful, which requeues the job associated with the Drone in case of using theHTCondorSiteAdapter
. So, the following pattern is occuring in the log.The Drone is in
ResourceState.Running
for a short moment before it goes toResourceState.Booting
again due to requeing. So the state of the Drone changes toIntegratingState
.Shortly afterwards the drone is
ResourceState.Booting
again and the Drone changes back toBootingState
again.This in turn leads to a re-insertion of the Drone in the
SqliteRegistry
causing the following error.sqlite3.IntegrityError: column drone_uuid is not unique
This pull request changes the initialisation procedure and the notfication of the plugins, so that the above behaviour is not occuring anymore. A newly created Drone is now initialised with
state = None
and all plugins are notified first state changeNone
->RequestState
. The Drone is now inserted when it state changes toRequestState
and all subsequent changes are DB updates.