nost-tools 3.0.0__py3-none-any.whl → 3.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nost-tools might be problematic. Click here for more details.

nost_tools/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "3.0.0"
1
+ __version__ = "3.0.2"
2
2
 
3
3
  from .application import Application
4
4
  from .application_utils import ConnectionConfig, ModeStatusObserver, TimeStatusPublisher
@@ -324,7 +324,27 @@ class ManagedApplication(Application):
324
324
  message = body.decode("utf-8")
325
325
  params = FreezeCommand.model_validate_json(message).tasking_parameters
326
326
  logger.info(f"Received freeze command {message}")
327
- # freeze simulation time
327
+
328
+ sim_freeze_time = params.sim_freeze_time
329
+ if sim_freeze_time is not None:
330
+ try:
331
+ # Only wait if we haven't reached the requested sim time yet
332
+ if self.simulator.get_time() < sim_freeze_time:
333
+ target_wc = self.simulator.get_wallclock_time_at_simulation_time(sim_freeze_time)
334
+ # Sleep in short intervals to keep responsiveness
335
+ while True:
336
+ now_wc = self.simulator.get_wallclock_time()
337
+ remaining = (target_wc - now_wc).total_seconds()
338
+ if remaining <= 0:
339
+ break
340
+ # Exit early if execution is stopping
341
+ if self.simulator.get_mode() in (Mode.TERMINATING, Mode.TERMINATED):
342
+ return
343
+ time.sleep(min(0.5, max(0.01, remaining)))
344
+ except Exception as e:
345
+ logger.warning(f"Could not align to simFreezeTime={sim_freeze_time}: {e}")
346
+
347
+ # Freeze simulation time
328
348
  self.simulator.pause()
329
349
 
330
350
  except Exception as e:
nost_tools/manager.py CHANGED
@@ -757,20 +757,6 @@ class Manager(Application):
757
757
  )
758
758
  return
759
759
 
760
- # Compute authoritative resume time
761
- target_resume_time = base + freeze_duration
762
- # Optionally honor requested resume_time if it's later than base
763
- if resume_time is not None and resume_time > base:
764
- # Keep the earlier of the two if you want to minimize drift across nodes,
765
- # or the later if you prefer never resuming before a requested time.
766
- # Here we choose the later to avoid early resume vs. a peer's expectation.
767
- target_resume_time = max(target_resume_time, resume_time)
768
-
769
- logger.info(
770
- f"Resume Time: requested={resume_time} calculated={target_resume_time} "
771
- f"delta={abs((target_resume_time - (resume_time or target_resume_time)).total_seconds())}s"
772
- )
773
-
774
760
  # Poll until we reach the target, allowing early exit and heartbeats
775
761
  while True:
776
762
  mode = self.simulator.get_mode()
@@ -782,8 +768,11 @@ class Manager(Application):
782
768
  ):
783
769
  break
784
770
  remaining = (
785
- target_resume_time - self.simulator.get_wallclock_time()
771
+ resume_time - self.simulator.get_wallclock_time()
786
772
  ).total_seconds()
773
+ logger.debug(
774
+ f"Resume Time: {resume_time} Current Scenario Time: {self.simulator.get_time()} Current Wall Clock Time: {self.simulator.get_wallclock_time()} Remaining time: {remaining}"
775
+ )
787
776
  if remaining <= 0:
788
777
  break
789
778
  self._sleep_with_heartbeat(min(1.0, max(0.01, remaining)))
nost_tools/simulator.py CHANGED
@@ -312,8 +312,6 @@ class Simulator(Observable):
312
312
  self._wallclock_epoch = self.get_wallclock_time()
313
313
  self._simulation_epoch = self._time
314
314
  self._set_mode(Mode.EXECUTING)
315
- # Return immediately after resume to avoid waiting
316
- return
317
315
  while (
318
316
  self._mode == Mode.EXECUTING
319
317
  and self.get_wallclock_time_at_simulation_time(self._next_time)
@@ -536,7 +534,7 @@ class Simulator(Observable):
536
534
  """
537
535
  Pauses the scenario execution. Requires that the simulator is in EXECUTING mode.
538
536
  """
539
- logger.info("Pausing simulation execution.")
537
+ logger.info(f"Pausing simulation execution at {self._time}.")
540
538
  if self._mode != Mode.EXECUTING:
541
539
  raise RuntimeError("Cannot pause: simulator is not executing.")
542
540
 
@@ -548,7 +546,6 @@ class Simulator(Observable):
548
546
  """
549
547
  if self._mode not in [Mode.PAUSING, Mode.PAUSED]:
550
548
  raise RuntimeError("Cannot resume: simulator is not pausing or paused.")
551
- self._next_time = self._time
552
549
  self._set_mode(Mode.RESUMING)
553
550
 
554
551
  def terminate(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nost_tools
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: Tools for Novel Observing Strategies Testbed (NOS-T) Applications
5
5
  Author-email: "Paul T. Grogan" <paul.grogan@asu.edu>, "Emmanuel M. Gonzalez" <emmanuelgonzalez@asu.edu>
6
6
  License-Expression: BSD-3-Clause
@@ -1,18 +1,18 @@
1
- nost_tools/__init__.py,sha256=U8ylAZeztjYh1QXalVZU8-0BsY1JKRqTFAcnUBxEJro,853
1
+ nost_tools/__init__.py,sha256=GvxR3KpH7ZhKsNxbgoPlXzzoGtojkcdaZ1Fr37W1XQk,853
2
2
  nost_tools/application.py,sha256=C-19kvRTHUt-xXA_0hBh1aoIE32fvTETwCqtrFswYCQ,67406
3
3
  nost_tools/application_utils.py,sha256=jiMzuuP6-47UlUO64HhwNvbl6uKvVnsksYgOw7CmxL4,9327
4
4
  nost_tools/configuration.py,sha256=qHXfWK_IrLj5Z8xWfF3H5rqHOLL0bLlZ3Ls73rTDHUk,13046
5
5
  nost_tools/entity.py,sha256=JrSN5rz7h-N9zIQsaJOQVBIYPDfygacedks55fsq_QQ,2802
6
6
  nost_tools/errors.py,sha256=0JcDlMEkZAya3-5c0rRozLuxp8qF58StG4JgRsaxfKU,344
7
7
  nost_tools/logger_application.py,sha256=rxPBfyA7Zym5b_EsoSJvT9JWNIVWZX1a-4czFwCqaQ4,7217
8
- nost_tools/managed_application.py,sha256=0P3_UHSQfdLqgaAnxjEJetkYU4P6M7NAHkOcRTUXe9o,18631
9
- nost_tools/manager.py,sha256=Xu200PlrNNMBhWMryRcuVT-_vE0oW5wrn7PtLLAPSIY,34148
8
+ nost_tools/managed_application.py,sha256=p34YBW0v-YDcm6MJ5W_CRqPsRgBQM-k0I_Ybu9Gw7Sw,19758
9
+ nost_tools/manager.py,sha256=0gDdzDKVje28sOojXCSAPxoDFP7wLBECNu9ZTtXprfc,33559
10
10
  nost_tools/observer.py,sha256=PmqxnVN422dIRgwH29RcvK331Q4vtH_eD7MP1eIe_vk,8564
11
11
  nost_tools/publisher.py,sha256=-p5G9JLVZKhNNOSUGlvDKyWZSHlWikQV1TabsNIyLJA,5714
12
12
  nost_tools/schemas.py,sha256=nuo0mdL1kouuuWXOROHTxA63lGJSvr15BDVygvl3PKU,24727
13
- nost_tools/simulator.py,sha256=AtAHVl0BLAZuewqnpheNoLIDbObD-PWh9an_-d4Dx40,21148
14
- nost_tools-3.0.0.dist-info/licenses/LICENSE,sha256=aAMU-mTHTKpWkBsg9QhkhCQpEm3Gri7J_fVuJov8s3s,1539
15
- nost_tools-3.0.0.dist-info/METADATA,sha256=OoZcUL8cm9QG7JNAyF4rVNPIntY1cX8Fsooq-U40dhw,4256
16
- nost_tools-3.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- nost_tools-3.0.0.dist-info/top_level.txt,sha256=LNChUgrv2-wiym12O0r61kY83COjTpTiJ2Ly1Ca58A8,11
18
- nost_tools-3.0.0.dist-info/RECORD,,
13
+ nost_tools/simulator.py,sha256=JkubEEExq080AnYwLCaeJCA1SWrhqQRl6KyoCdfYSac,21046
14
+ nost_tools-3.0.2.dist-info/licenses/LICENSE,sha256=aAMU-mTHTKpWkBsg9QhkhCQpEm3Gri7J_fVuJov8s3s,1539
15
+ nost_tools-3.0.2.dist-info/METADATA,sha256=g-Aj-9pqt8CVr2lqfknhVn0fVVXlyeJ241R-W33Uq1o,4256
16
+ nost_tools-3.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ nost_tools-3.0.2.dist-info/top_level.txt,sha256=LNChUgrv2-wiym12O0r61kY83COjTpTiJ2Ly1Ca58A8,11
18
+ nost_tools-3.0.2.dist-info/RECORD,,