def options_fingerprint(self): return OptionsFingerprinter.combined_options_fingerprint_for_scope( GLOBAL_SCOPE, self._bootstrap_options, fingerprint_key='daemon', invert=True )
def prepare_scheduler( self, options_bootstrapper: OptionsBootstrapper) -> LegacyGraphScheduler: """Get a scheduler for the given options_bootstrapper. Runs in a client context (generally in DaemonPantsRunner) so logging is sent to the client. """ # Compute the fingerprint of the bootstrap options. Note that unlike # PantsDaemonProcessManager (which fingerprints only `daemon=True` options), this # fingerprints all fingerprintable options in the bootstrap options, which are # all used to construct a Scheduler. options_fingerprint = OptionsFingerprinter.combined_options_fingerprint_for_scope( GLOBAL_SCOPE, options_bootstrapper.bootstrap_options, invert=True, ) with self._lifecycle_lock: if self._scheduler is None or options_fingerprint != self._fingerprint: # The fingerprint mismatches, either because this is the first run (and there is no # fingerprint) or because relevant options have changed. Create a new scheduler and services. self._init_scheduler(options_fingerprint, options_bootstrapper) assert self._scheduler is not None return self._scheduler
def options_fingerprint(self): return OptionsFingerprinter.combined_options_fingerprint_for_scope( GLOBAL_SCOPE, self._bootstrap_options, fingerprint_key='daemon', invert=True )
def prepare( self, options_bootstrapper: OptionsBootstrapper, env: CompleteEnvironment ) -> tuple[GraphScheduler, OptionsInitializer]: """Get a scheduler for the given options_bootstrapper. Runs in a client context (generally in DaemonPantsRunner) so logging is sent to the client. """ with self._handle_exceptions(): build_config, options = self._options_initializer.build_config_and_options( options_bootstrapper, env, raise_=True) scheduler_restart_explanation: str | None = None # Because these options are computed dynamically via side-effects like reading from a file, # they need to be re-evaluated every run. We only reinitialize the scheduler if changes # were made, though. dynamic_remote_options, auth_plugin_result = DynamicRemoteOptions.from_options( options, env, self._prior_auth_plugin_result) remote_options_changed = ( self._prior_dynamic_remote_options is not None and dynamic_remote_options != self._prior_dynamic_remote_options) if remote_options_changed: scheduler_restart_explanation = "Remote cache/execution options updated" # Compute the fingerprint of the bootstrap options. Note that unlike # PantsDaemonProcessManager (which fingerprints only `daemon=True` options), this # fingerprints all fingerprintable options in the bootstrap options, which are # all used to construct a Scheduler. options_fingerprint = OptionsFingerprinter.combined_options_fingerprint_for_scope( GLOBAL_SCOPE, options_bootstrapper.bootstrap_options, ) bootstrap_options_changed = (self._fingerprint is not None and options_fingerprint != self._fingerprint) if bootstrap_options_changed: scheduler_restart_explanation = "Initialization options changed" with self._lifecycle_lock: if self._scheduler is None or scheduler_restart_explanation: # The fingerprint mismatches, either because this is the first run (and there is no # fingerprint) or because relevant options have changed. Create a new scheduler # and services. bootstrap_options = options.bootstrap_option_values() assert bootstrap_options is not None with self._handle_exceptions(): self._initialize( options_fingerprint, bootstrap_options, build_config, dynamic_remote_options, scheduler_restart_explanation, ) self._prior_dynamic_remote_options = dynamic_remote_options self._prior_auth_plugin_result = auth_plugin_result assert self._scheduler is not None return self._scheduler, self._options_initializer
def _options_fingerprint(self, scope): options_hasher = sha1() options_hasher.update(scope.encode()) options_fp = OptionsFingerprinter.combined_options_fingerprint_for_scope( scope, self.context.options, build_graph=self.context.build_graph, ) options_hasher.update(options_fp.encode()) return options_hasher.hexdigest()
def _options_fingerprint(self, scope): options_hasher = sha1() options_hasher.update(scope) options_fp = OptionsFingerprinter.combined_options_fingerprint_for_scope( scope, self.context.options, build_graph=self.context.build_graph, include_passthru=self.supports_passthru_args(), ) options_hasher.update(options_fp) return options_hasher.hexdigest()
def _options_fingerprint(self, scope): options_hasher = sha1() options_hasher.update(scope.encode('utf-8')) options_fp = OptionsFingerprinter.combined_options_fingerprint_for_scope( scope, self.context.options, build_graph=self.context.build_graph, include_passthru=self.supports_passthru_args(), ) options_hasher.update(options_fp.encode('utf-8')) return options_hasher.hexdigest() if PY3 else options_hasher.hexdigest().decode('utf-8')
def options_fingerprint(self): """Returns the options fingerprint for the pantsd process. This should cover all options consumed by the pantsd process itself in order to start: also known as the "micro-bootstrap" options. These options are marked `daemon=True` in the global options. The `daemon=True` options are a small subset of the bootstrap options. Independently, the PantsDaemonCore fingerprints the entire set of bootstrap options to identify when the Scheduler needs need to be re-initialized. """ return OptionsFingerprinter.combined_options_fingerprint_for_scope( GLOBAL_SCOPE, self._bootstrap_options, fingerprint_key="daemon")