diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e46a855..a555d56e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ ### Upcoming - #### Enhancements - - improvements to the UI's experiment profile preview. It's so pretty! + - UI chips everywhere! + - improvements to the UI's experiment profile preview. - `hours_elapsed()` is a function in profile expressions, which returns the hours since the profile started. - `unit()` can be used in mqtt fetch expressions. Example: `unit():stirring:target_rpm` is identical to `::stirring:target_rpm`. The latter can be seen as a shortened version of the former. - experiment profiles can have a `description` in the `job` field (i.e. beside `actions`). diff --git a/pioreactor/background_jobs/temperature_automation.py b/pioreactor/background_jobs/temperature_automation.py index ada9e1fb..4861e2bd 100644 --- a/pioreactor/background_jobs/temperature_automation.py +++ b/pioreactor/background_jobs/temperature_automation.py @@ -606,12 +606,7 @@ def _set_growth_rate(self, message: pt.MQTTMessage) -> None: self.latest_growth_rate_at = payload.timestamp def _set_latest_temperature(self, temperature: structs.Temperature) -> None: - # we want to avoid a flurry of temperature data coming in, i.e. after a network reconnect. - # naive solution: only allow temp data from within 5m - if (current_utc_datetime() - temperature.timestamp).total_seconds() >= 5 * 60: - self.logger.debug(f"Temperature data too old to execute on: {temperature}") - return - + # Note: this doesn't use MQTT data (previously it use to) self.previous_temperature = self.latest_temperature self.latest_temperature = temperature.temperature self.latest_temperature_at = temperature.timestamp diff --git a/pioreactor/structs.py b/pioreactor/structs.py index 5ae7c4e4..032ad6ff 100644 --- a/pioreactor/structs.py +++ b/pioreactor/structs.py @@ -31,48 +31,6 @@ def _add(cls): return t.Union[tuple(classes)] # type: ignore -class Automation(Struct): - """ - Used to change an automation over MQTT. - """ - - automation_name: str - args: dict = {} - - def __str__(self) -> str: - s = "" - s += f"{self.automation_name}" - s += "(" - for i, (k, v) in enumerate(self.args.items()): - if k == "skip_first_run": - v = bool(int(v)) - if i == 0: - s += f"{k}={v}" - else: - s += f", {k}={v}" - - s += ")" - return s - - def __repr__(self) -> str: - return str(self) - - -class TemperatureAutomation(Automation, tag="temperature"): # type: ignore - ... - - -class DosingAutomation(Automation, tag="dosing"): # type: ignore - ... - - -class LEDAutomation(Automation, tag="led"): # type: ignore - ... - - -AnyAutomation = t.Union[LEDAutomation, TemperatureAutomation, DosingAutomation] - - class AutomationSettings(Struct): """ Metadata produced when settings in an automation job change diff --git a/pioreactor/utils/__init__.py b/pioreactor/utils/__init__.py index e9dc4bba..d96e1192 100644 --- a/pioreactor/utils/__init__.py +++ b/pioreactor/utils/__init__.py @@ -502,20 +502,20 @@ def kill_jobs(self) -> int: class MQTTKill: def __init__(self) -> None: - self.list_of_job_names: list[str] = [] + self.job_names_to_kill: list[str] = [] def append(self, name: str) -> None: - self.list_of_job_names.append(name) + self.job_names_to_kill.append(name) def kill_jobs(self) -> int: count = 0 - if len(self.list_of_job_names) == 0: + if len(self.job_names_to_kill) == 0: return count from pioreactor.pubsub import create_client with create_client() as client: - for i, name in enumerate(self.list_of_job_names): + for i, name in enumerate(self.job_names_to_kill): count += 1 msg = client.publish( f"pioreactor/{whoami.get_unit_name()}/{whoami.UNIVERSAL_EXPERIMENT}/{name}/$state/set", @@ -523,7 +523,7 @@ def kill_jobs(self) -> int: qos=1, ) - if (i + 1) == len(self.list_of_job_names): + if (i + 1) == len(self.job_names_to_kill): # last one msg.wait_for_publish(2) @@ -531,7 +531,6 @@ def kill_jobs(self) -> int: class JobManager: - AUTOMATION_JOBS = ("temperature_automation", "dosing_automation", "led_automation") PUMPING_JOBS = ( "add_media", "remove_waste", @@ -634,9 +633,6 @@ def kill_jobs(self, all_jobs: bool = False, **query) -> int: elif job == "led_intensity": # led_intensity doesn't register with the JobManager, probably should somehow. #502 pass - elif job in self.AUTOMATION_JOBS: - # don't kill them, the parent will. - pass else: shell_kill.append(pid) count += mqtt_kill.kill_jobs() diff --git a/pioreactor/utils/sqlite_worker.py b/pioreactor/utils/sqlite_worker.py index 2e358671..def68b26 100644 --- a/pioreactor/utils/sqlite_worker.py +++ b/pioreactor/utils/sqlite_worker.py @@ -148,11 +148,6 @@ def close(self) -> None: # Check that the thread is done before returning. self.join() - @property - def queue_size(self) -> int: - """Return the queue size.""" - return self._sql_queue.qsize() - def _query_results(self, token: str): """Get the query results for a specific token.