def _WatchFieldGroup(self): """ Initiate the host engine watch on the fields """ ret = dcgm_agent.dcgmWatchFields(self._handle, self._groupId, self._fieldGroup.fieldGroupId, self._updateFreq, self._maxKeepAge, self._maxKeepSamples) # Will throw exception on error dcgm_structs._dcgmCheckReturn(ret) # Force an update of the fields so that we can fetch initial values ret = dcgm_agent.dcgmUpdateAllFields(self._handle, 1) # Will throw exception on error dcgm_structs._dcgmCheckReturn(ret) # initial update will fetch from startTimestamp self.GetMore()
def GetMore(self): """ Method to cause more field values to be retrieved from DCGM. Returns the number of field values that were retrieved """ beforeCount = self._numValuesSeen # If we're in manual mode, force an update if self._oprationMode == dcgm_structs.DCGM_OPERATION_MODE_MANUAL: ret = dcgm_agent.dcgmUpdateAllFields(self._handle, 1) # Will throw exception on error dcgm_structs._dcgmCheckReturn(ret) self._nextSinceTimestamp = dcgm_agent.dcgmGetValuesSince_v2( self._handle, self._groupId, self._fieldGroup.fieldGroupId, self._nextSinceTimestamp, helper_dcgm_field_values_since_entity_callback, self) afterCount = self._numValuesSeen return afterCount - beforeCount