diff --git a/CHANGELOG.md b/CHANGELOG.md index 57bde473..ba14f2b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,15 +9,14 @@ #### Enhancements - improvements to Dodging background job code, including the ability to initialize the class based on dodging or not. - - better error handling for failed OD blanks. + - better error handling for failed OD blank action. - better button state management in the UI. - - job YAMLs' published_settings can have a new field, `editable` (bool), which controls whether it shows up on the Settings dialog or not. (False means it won't show up since it's not editable!). Default is true. This _should_ align with the `published_setting` in Python's job classes. + - a job YAMLs' published_settings can have a new field, `editable` (bool), which controls whether it shows up on the Settings dialog or not. (False means it won't show up since it's not editable!). Default is true. This _should_ align with the `published_setting` in Python's job classes. - you can add IPv4 addresses to the (new) `[cluster.addresses]` section to specify IPs for pioreactors. Example: ``` - - [cluster.addresses] - pio01_address=10.42.0.2 - pio02_address=10.42.0.3 + [cluster.addresses] + pio01=10.42.0.2 + pio02=10.42.0.3 ``` Note that the leader's address is automatically added in our software. @@ -28,7 +27,7 @@ - Fixed "circulate X" actions in the Manage All dialog in the UI. #### Breaking changes - - moved all the temporary caches, which previously where their own sqlite3 db in /tmp/ to /tmp/local_intermittent_pioreactor_metadata.sqlite. This shouldn't break anything unless you update _during_ an experiment - don't do that! + - moved all the temporary caches, which previously where their own sqlite3 dbs in `/tmp/` to `/tmp/local_intermittent_pioreactor_metadata.sqlite`. This shouldn't break anything unless you update _during_ an experiment - don't do that! ### 24.10.29 diff --git a/pioreactor/background_jobs/base.py b/pioreactor/background_jobs/base.py index b5820c4f..df1fc639 100644 --- a/pioreactor/background_jobs/base.py +++ b/pioreactor/background_jobs/base.py @@ -1053,8 +1053,12 @@ def __post__init__(self): self.set_enable_dodging_od( config.getboolean(f"{self.job_name}.config", "enable_dodging_od", fallback="False") ) - self.start_passive_listeners() - super().__post__init__() + # now that `enable_dodging_od` is set, we can check for OD + self.subscribe_and_callback( + self._od_reading_changed_status, + f"pioreactor/{self.unit}/{self.experiment}/od_reading/interval", + ) + super().__post__init__() # set ready def set_currently_dodging_od(self, value: bool): self.currently_dodging_od = value @@ -1094,13 +1098,6 @@ def initialize_dodging_operation(self) -> None: def initialize_continuous_operation(self) -> None: pass - def _start_general_passive_listeners(self) -> None: - super()._start_general_passive_listeners() - self.subscribe_and_callback( - self._od_reading_changed_status, - f"pioreactor/{self.unit}/{self.experiment}/od_reading/interval", - ) - def _od_reading_changed_status(self, msg): if self.enable_dodging_od: # only act if our internal state is discordant with the external state diff --git a/pioreactor/background_jobs/stirring.py b/pioreactor/background_jobs/stirring.py index 687b583d..4cf0afdb 100644 --- a/pioreactor/background_jobs/stirring.py +++ b/pioreactor/background_jobs/stirring.py @@ -281,18 +281,21 @@ def action_to_do_after_od_reading(self): self.poll_and_update_dc() def initialize_dodging_operation(self): - if config.getfloat("od_reading.config", "samples_per_second") > 0.121: + if config.getfloat("od_reading.config", "samples_per_second") > 0.12: self.logger.warning( "Recommended to decrease `samples_per_second` to ensure there is time to start/stop stirring. Try 0.12 or less." ) + with suppress(AttributeError): + self.rpm_check_repeated_thread.cancel() + self.rpm_check_repeated_thread = RepeatedTimer( 1_000, lambda *args: None, job_name=self.job_name, logger=self.logger, ) - self.stop_stirring() # we'll start it in action_to_do_after_od_reading + self.stop_stirring() # we'll start it again in action_to_do_after_od_reading def initialize_continuous_operation(self): # set up thread to periodically check the rpm diff --git a/pioreactor/cli/pio.py b/pioreactor/cli/pio.py index 7da5de88..48479443 100644 --- a/pioreactor/cli/pio.py +++ b/pioreactor/cli/pio.py @@ -531,7 +531,7 @@ def update_app( logger.error("Update failed. See logs.") # end early raise click.Abort() - else: + elif p.stdout: logger.debug(p.stdout) logger.notice(f"Updated Pioreactor app to version {version_installed}.") # type: ignore diff --git a/pioreactor/config.py b/pioreactor/config.py index f30a3017..47953db8 100644 --- a/pioreactor/config.py +++ b/pioreactor/config.py @@ -168,7 +168,7 @@ def get_config() -> ConfigParserMod: leader_hostname = config.get("cluster.topology", "leader_hostname") leader_address = config.get("cluster.topology", "leader_address") - config.set("cluster.addresses", f"{leader_hostname}_address", leader_address) + config.set("cluster.addresses", leader_hostname, leader_address) return config diff --git a/pioreactor/utils/networking.py b/pioreactor/utils/networking.py index c38d1934..85ef8923 100644 --- a/pioreactor/utils/networking.py +++ b/pioreactor/utils/networking.py @@ -147,7 +147,7 @@ def worker_hostnames(queue: Queue) -> None: def resolve_to_address(hostname: str) -> str: # TODO: make this more fleshed out: resolve to IP, etc. # add_local assumes a working mDNS. - address_in_config = config.get("cluster.addresses", f"{hostname}_address", fallback=None) + address_in_config = config.get("cluster.addresses", hostname, fallback=None) if address_in_config is not None: return address_in_config else: diff --git a/pioreactor/utils/timing.py b/pioreactor/utils/timing.py index 0c3932ae..48d0d229 100644 --- a/pioreactor/utils/timing.py +++ b/pioreactor/utils/timing.py @@ -179,7 +179,8 @@ def unpause(self) -> None: self.is_paused = False def cancel(self, timeout: t.Optional[float] = None) -> None: - self.event.set() + self.pause() # this will exit from the _target early. + self.event.set() # stop waiting in _target. with suppress(RuntimeError): # possible to happen if self.thread hasn't started yet, diff --git a/update_scripts/upcoming/datasets.zip b/update_scripts/upcoming/datasets.zip index 6d3f86ba..cf819d45 100644 Binary files a/update_scripts/upcoming/datasets.zip and b/update_scripts/upcoming/datasets.zip differ diff --git a/update_scripts/upcoming/install_pioreactor_plugin.sh b/update_scripts/upcoming/install_pioreactor_plugin.sh index 37dd04fd..44357906 100644 --- a/update_scripts/upcoming/install_pioreactor_plugin.sh +++ b/update_scripts/upcoming/install_pioreactor_plugin.sh @@ -81,7 +81,7 @@ fi if [ "$am_i_leader" = true ]; then # merge new config.ini if test -f "$install_folder/additional_config.ini"; then - crudini --merge /home/pioreactor/.pioreactor/config.ini < "$install_folder/additional_config.ini" + crudini --ini-options=nospace --merge /home/pioreactor/.pioreactor/config.ini < "$install_folder/additional_config.ini" fi # add any new sql, restart mqtt_to_db job, too diff --git a/update_scripts/upcoming/update.sh b/update_scripts/upcoming/update.sh index e11c2c45..d51c74cd 100644 --- a/update_scripts/upcoming/update.sh +++ b/update_scripts/upcoming/update.sh @@ -12,7 +12,7 @@ HOSTNAME=$(hostname) # Get the leader hostname # Don't use `leader_address`, as users do change that. -LEADER_HOSTNAME=$(crudini --get "$PIO_DIR"/config.ini cluster.topology leader_hostname) +LEADER_HOSTNAME=$(crudini --get /home/pioreactor/.pioreactor/config.ini cluster.topology leader_hostname) if [ "$HOSTNAME" = "$LEADER_HOSTNAME" ]; then crudini --set /home/pioreactor/.pioreactor/config.ini cluster_addresses \ @@ -37,5 +37,5 @@ if [ "$HOSTNAME" = "$LEADER_HOSTNAME" ]; then fi -sudo -u pioreactor cp "$SCRIPT_DIR/install_pioreactor_plugin.sh" /usr/local/bin/install_pioreactor_plugin.sh -sudo -u pioreactor cp "$SCRIPT_DIR/uninstall_pioreactor_plugin.sh" /usr/local/bin/uninstall_pioreactor_plugin.sh +cp "$SCRIPT_DIR/install_pioreactor_plugin.sh" /usr/local/bin/install_pioreactor_plugin.sh +cp "$SCRIPT_DIR/uninstall_pioreactor_plugin.sh" /usr/local/bin/uninstall_pioreactor_plugin.sh