manta-node 0.6b1.dev652__py3-none-any.whl → 0.6b1.dev657__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.
@@ -4,7 +4,7 @@ This file is auto-generated at build time by scripts/generate_version.py.
4
4
  Do not edit manually.
5
5
  """
6
6
 
7
- __version__ = "2026.09.17.be0c65f9"
8
- __build_date__ = "2026.09.17"
9
- __commit_id__ = "be0c65f9"
7
+ __version__ = "2026.09.18.4910343a"
8
+ __build_date__ = "2026.09.18"
9
+ __commit_id__ = "4910343a"
10
10
  __package_version__ = "0.6b1"
@@ -148,6 +148,8 @@ class TaskManager:
148
148
  self._stopped_swarms: set[TupleID] = set()
149
149
  self.image_task_ids: set[tuple[TupleID, TupleID]] = set()
150
150
  self._launching: set[tuple[TupleID, TupleID]] = set()
151
+ # Tasks between the remove and the run of a recreate: nothing to poll yet.
152
+ self._recreating: set[tuple[TupleID, TupleID]] = set()
151
153
 
152
154
  @property
153
155
  def async_client(self):
@@ -252,9 +254,13 @@ class TaskManager:
252
254
  except MantaGRPCError as e:
253
255
  self.tracer.exception(f"Error when executing task: {e}")
254
256
  except MantaError as manta_error:
257
+ self._apply_deploy_metadata(in_flight)
255
258
  self.tracer.exception("Error when executing task.")
259
+ # An executor-raised error has no swarm/task id: give it the deploy's.
260
+ manta_error.metadata = self.tracer.metadata
256
261
  await self.node_client.send_error(manta_error)
257
262
  except Exception as exc:
263
+ self._apply_deploy_metadata(in_flight)
258
264
  message = f"Error when executing task: {exc!r}"
259
265
  self.tracer.exception(message)
260
266
  await self.node_client.send_error(
@@ -301,11 +307,17 @@ class TaskManager:
301
307
  # Update the tasks status
302
308
  updated = []
303
309
  for task_progression in self.tasks.active_tasks():
310
+ env_tid_pair = (task_progression.swarm_id.tid, task_progression.task_id.tid)
311
+ if env_tid_pair in self._recreating:
312
+ # Nothing to read between remove and run; polled again once unmarked.
313
+ continue
304
314
  try:
305
315
  has_changed = await self.from_pending_to_running(task_progression)
306
316
  if not task_progression.is_finished_task() and has_changed:
307
317
  updated.append(task_progression)
308
318
  except Exception as exc:
319
+ # The shared tracer may hold another coroutine's ids: stamp this task's.
320
+ self._apply_task_metadata(task_progression)
309
321
  message = f"Error updating active tasks: {exc!r}"
310
322
  self.tracer.exception("Error updating active tasks.")
311
323
  await self.node_client.send_error(
@@ -450,17 +462,25 @@ class TaskManager:
450
462
  # Recreate per round: a fresh container must not keep the prior run's exit state.
451
463
  swarm_id = task_progression.swarm_id
452
464
  task_id = task_progression.task_id
465
+ # Marked in the same synchronous run as the PENDING write above and held
466
+ # across remove + run (cleared in ``finally``); the poll skips a marked task.
467
+ self._recreating.add(env_tid_pair)
453
468
  try:
454
- await self.remove_container(swarm_id, task_id)
455
- except ContainerNotFoundException:
456
- self.tracer.warning(
457
- f"Task {task_id} container not found on redeploy; recreating anyway"
458
- )
459
- is_image = env_tid_pair in self.image_task_ids
460
- if is_image:
461
- start_time = await self._run_image_mode(swarm_id, task_id, task)
462
- else:
463
- start_time = await self._launch_zipapp(task, task_progression.module_file)
469
+ try:
470
+ await self.remove_container(swarm_id, task_id)
471
+ except ContainerNotFoundException:
472
+ self.tracer.warning(
473
+ f"Task {task_id} container not found on redeploy; recreating anyway"
474
+ )
475
+ is_image = env_tid_pair in self.image_task_ids
476
+ if is_image:
477
+ start_time = await self._run_image_mode(swarm_id, task_id, task)
478
+ else:
479
+ start_time = await self._launch_zipapp(
480
+ task, task_progression.module_file
481
+ )
482
+ finally:
483
+ self._recreating.discard(env_tid_pair)
464
484
  # The backend run is return-less (TaskExecutor); fall back to now.
465
485
  task_progression.start_time = start_time or datetime.now(timezone.utc)
466
486
 
@@ -643,6 +663,21 @@ class TaskManager:
643
663
  raise
644
664
  self.tracer.info(f"Task {task_id} restarted successfully")
645
665
 
666
+ def _apply_deploy_metadata(self, task: MqttTask | None) -> None:
667
+ """Stamp the tracer with the identity of a deploy message.
668
+
669
+ Same contract as ``_apply_task_metadata``: call it right before the
670
+ header or an error is read. ``None`` (no deploy in flight) is a no-op.
671
+ """
672
+ if task is None:
673
+ return
674
+ self.tracer.set_metadata(
675
+ task_id=ID(task.task_id),
676
+ swarm_id=ID(task.swarm_id),
677
+ iteration=task.iteration,
678
+ circular=task.circular,
679
+ )
680
+
646
681
  def _apply_task_metadata(self, task_progression: TaskProgression) -> None:
647
682
  """Stamp the tracer with this task's identity.
648
683
 
@@ -832,12 +867,16 @@ class TaskManager:
832
867
  except MantaGRPCError as e:
833
868
  self.tracer.exception(f"gRPCError when stopping swarm: {e}")
834
869
  except MantaError as manta_error:
870
+ self._apply_task_metadata(task_progression)
835
871
  self.tracer.exception(
836
872
  f"Unable to stop task {task_progression.task_id}"
837
873
  f" of swarm {swarm_id}"
838
874
  )
875
+ # An executor-raised error has no swarm/task id: give it this task's.
876
+ manta_error.metadata = self.tracer.metadata
839
877
  await self.node_client.send_error(manta_error)
840
878
  except Exception as exc:
879
+ self._apply_task_metadata(task_progression)
841
880
  trace_message = (
842
881
  f"Unable to stop task {task_progression.task_id}"
843
882
  f" of swarm {swarm_id}: {exc!r}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: manta_node
3
- Version: 0.6b1.dev652
3
+ Version: 0.6b1.dev657
4
4
  Summary: Node side software of the Manta platform. It is responsible for the communication with the Manta Core and the execution of the tasks.
5
5
  Author-email: Hugo Miralles <hugo.miralles@manta-tech.io>, Matthew Thompson <matthew.thompson@manta-tech.io>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -1,11 +1,11 @@
1
1
  manta_node/__init__.py,sha256=bgGWXH3yQVhNf0v1ZGUBAy5Y51fqb0Y-EaLnocbcino,153
2
2
  manta_node/__main__.py,sha256=SjrJyuMg_ZFKV6WOVe3MrtWM8Qmu065dkKZYl4n2YLw,1665
3
3
  manta_node/node_orchestrator.py,sha256=K2UZAk-FHs1ERrwf5hTcrQC2AASG2J2eVlr-l45aDt4,28066
4
- manta_node/task_manager.py,sha256=u6dy5WfPs3UTo8MQ9t00rJRqkPM2Tif_lvfCOdYg7gw,36033
4
+ manta_node/task_manager.py,sha256=xRE-yKdUW0FFR8vtX1jDwl1AxTbqVD_JS7QVR62GA00,38002
5
5
  manta_node/tasks.py,sha256=o837Hi-KFVJg9LF5iOtE8oD6UuTOfrEPWR-JOdhRGeY,6983
6
6
  manta_node/utils.py,sha256=Hw4Iw2jYQYsfVLVJuBMt-_rMFBeml3nCDE2jiiXc8YM,1155
7
7
  manta_node/cli/__init__.py,sha256=arzO3mXDJ-E2yeeytbZfN7mCswwxdQ43_QjyeL2E5yE,134
8
- manta_node/cli/_version_generated.py,sha256=nfn7HVJSskYaqDyFjXX4qGudJ-A4W-6FEJ636aucJlM,275
8
+ manta_node/cli/_version_generated.py,sha256=Pn3irC1SaOoMzcPHsCV4_u9N2RgISqZ1xuxqnFOhjRA,275
9
9
  manta_node/cli/config_manager.py,sha256=BCju9zqzraviL3KrzRnB-vZQUY__Q5kuEqb7EdB8YdI,4409
10
10
  manta_node/cli/main.py,sha256=dZa6zrypWBvpN8hd4qpxevvlyNFhxKINCg1537NJ36w,4318
11
11
  manta_node/cli/version.py,sha256=KbI0pHsBxT5LayA9fTTMBR6LIIcDeZJxyqQCwjQO560,3115
@@ -51,9 +51,9 @@ manta_node/infrastructure/process/executor.py,sha256=Ab1XvNuelEGCD5KdZLgYYnpjYZ5
51
51
  manta_node/infrastructure/security/__init__.py,sha256=lI6vkbUmfmt0m363iO4HzuzVNoQAc7Clp2R5vAhZbgE,64
52
52
  manta_node/infrastructure/security/auth_agent.py,sha256=WkPTg_g0gix7xomb_on_Ft3TNX0FpeqS7gwgJW9mTvk,11037
53
53
  manta_node/infrastructure/security/token_provider.py,sha256=u3bcbQYNBskFzunO-wOSZpGkDN_CU1BCB5HUbZTC4Vg,1832
54
- manta_node-0.6b1.dev652.dist-info/licenses/LICENSE,sha256=9mBgLhiB9goQPQjg9XQJ6FjgVxYw9Q8lyOZYkPGwF_c,34484
55
- manta_node-0.6b1.dev652.dist-info/METADATA,sha256=NCnhIucjmVoOaWJSHM5HiR7tLJ-KOP9U7p52Lbm_S68,4213
56
- manta_node-0.6b1.dev652.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
57
- manta_node-0.6b1.dev652.dist-info/entry_points.txt,sha256=C_zcw6mdmztNxVUZGLZ83UH5TwcSuqb2C-rB4e2CQoc,56
58
- manta_node-0.6b1.dev652.dist-info/top_level.txt,sha256=nbT5J5WETuXM9UPoQckl29uUOq8wMYdRb9QDx5kAFeo,11
59
- manta_node-0.6b1.dev652.dist-info/RECORD,,
54
+ manta_node-0.6b1.dev657.dist-info/licenses/LICENSE,sha256=9mBgLhiB9goQPQjg9XQJ6FjgVxYw9Q8lyOZYkPGwF_c,34484
55
+ manta_node-0.6b1.dev657.dist-info/METADATA,sha256=4Cps3oG_vvfCq12Khf60z_hbAtPGmgu5KBn71xFSTTY,4213
56
+ manta_node-0.6b1.dev657.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
57
+ manta_node-0.6b1.dev657.dist-info/entry_points.txt,sha256=C_zcw6mdmztNxVUZGLZ83UH5TwcSuqb2C-rB4e2CQoc,56
58
+ manta_node-0.6b1.dev657.dist-info/top_level.txt,sha256=nbT5J5WETuXM9UPoQckl29uUOq8wMYdRb9QDx5kAFeo,11
59
+ manta_node-0.6b1.dev657.dist-info/RECORD,,