loom-core 0.1.6__tar.gz → 0.1.8__tar.gz

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.
Files changed (58) hide show
  1. {loom_core-0.1.6 → loom_core-0.1.8}/PKG-INFO +1 -1
  2. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/context.py +6 -5
  3. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/logger.py +2 -1
  4. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/state.py +3 -0
  5. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/PKG-INFO +1 -1
  6. {loom_core-0.1.6 → loom_core-0.1.8}/pyproject.toml +1 -1
  7. {loom_core-0.1.6 → loom_core-0.1.8}/LICENSE +0 -0
  8. {loom_core-0.1.6 → loom_core-0.1.8}/MANIFEST.in +0 -0
  9. {loom_core-0.1.6 → loom_core-0.1.8}/QUICKSTART.md +0 -0
  10. {loom_core-0.1.6 → loom_core-0.1.8}/README.md +0 -0
  11. {loom_core-0.1.6 → loom_core-0.1.8}/loom/__init__.py +0 -0
  12. {loom_core-0.1.6 → loom_core-0.1.8}/loom/cli/__init__.py +0 -0
  13. {loom_core-0.1.6 → loom_core-0.1.8}/loom/cli/cli.py +0 -0
  14. {loom_core-0.1.6 → loom_core-0.1.8}/loom/common/activity.py +0 -0
  15. {loom_core-0.1.6 → loom_core-0.1.8}/loom/common/config.py +0 -0
  16. {loom_core-0.1.6 → loom_core-0.1.8}/loom/common/errors.py +0 -0
  17. {loom_core-0.1.6 → loom_core-0.1.8}/loom/common/workflow.py +0 -0
  18. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/__init__.py +0 -0
  19. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/compiled.py +0 -0
  20. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/engine.py +0 -0
  21. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/handle.py +0 -0
  22. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/runner.py +0 -0
  23. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/worker.py +0 -0
  24. {loom_core-0.1.6 → loom_core-0.1.8}/loom/core/workflow.py +0 -0
  25. {loom_core-0.1.6 → loom_core-0.1.8}/loom/database/__init__.py +0 -0
  26. {loom_core-0.1.6 → loom_core-0.1.8}/loom/database/db.py +0 -0
  27. {loom_core-0.1.6 → loom_core-0.1.8}/loom/decorators/__init__.py +0 -0
  28. {loom_core-0.1.6 → loom_core-0.1.8}/loom/decorators/activity.py +0 -0
  29. {loom_core-0.1.6 → loom_core-0.1.8}/loom/decorators/workflow.py +0 -0
  30. {loom_core-0.1.6 → loom_core-0.1.8}/loom/lib/progress.py +0 -0
  31. {loom_core-0.1.6 → loom_core-0.1.8}/loom/lib/utils.py +0 -0
  32. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/001_setup_pragma.sql +0 -0
  33. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/002_create_workflows.sql +0 -0
  34. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/003.create_events.sql +0 -0
  35. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/004.create_tasks.sql +0 -0
  36. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/005.create_indexes.sql +0 -0
  37. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/006_auto_update_triggers.sql +0 -0
  38. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/down/007_create_logs.sql +0 -0
  39. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/001_setup_pragma.sql +0 -0
  40. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/002_create_workflows.sql +0 -0
  41. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/003_create_events.sql +0 -0
  42. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/004_create_tasks.sql +0 -0
  43. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/005_create_indexes.sql +0 -0
  44. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/006_auto_update_triggers.sql +0 -0
  45. {loom_core-0.1.6 → loom_core-0.1.8}/loom/migrations/up/007_create_logs.sql +0 -0
  46. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/__init__.py +0 -0
  47. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/activity.py +0 -0
  48. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/database.py +0 -0
  49. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/events.py +0 -0
  50. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/tasks.py +0 -0
  51. {loom_core-0.1.6 → loom_core-0.1.8}/loom/schemas/workflow.py +0 -0
  52. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/SOURCES.txt +0 -0
  53. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/dependency_links.txt +0 -0
  54. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/entry_points.txt +0 -0
  55. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/requires.txt +0 -0
  56. {loom_core-0.1.6 → loom_core-0.1.8}/loom_core.egg-info/top_level.txt +0 -0
  57. {loom_core-0.1.6 → loom_core-0.1.8}/setup.cfg +0 -0
  58. {loom_core-0.1.6 → loom_core-0.1.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loom-core
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Durable workflow orchestration engine for Python
5
5
  Home-page: https://github.com/satadeep3927/loom
6
6
  Author: Satadeep Dasgupta
@@ -37,6 +37,7 @@ class WorkflowContext(Generic[InputT, StateT]):
37
37
  state: StateProxy[InputT, StateT]
38
38
  cursor: int = 0
39
39
  logger: WorkflowLogger
40
+ _original_history_length: int # Track original history size for replay detection
40
41
 
41
42
  def __init__(
42
43
  self, id: str, input: InputT, history: List[Event], state: StateT
@@ -52,6 +53,7 @@ class WorkflowContext(Generic[InputT, StateT]):
52
53
  self.id = id
53
54
  self.input = input
54
55
  self.history = history
56
+ self._original_history_length = len(history) # Remember original size
55
57
  self.state = StateProxy(self, state)
56
58
  self.logger = WorkflowLogger(self)
57
59
 
@@ -108,14 +110,13 @@ class WorkflowContext(Generic[InputT, StateT]):
108
110
 
109
111
  @property
110
112
  def is_replaying(self) -> bool:
111
- """Check if the workflow is currently replaying events.
113
+ """Check if the workflow is currently replaying old events.
112
114
 
113
115
  Returns:
114
- True if there are remaining events to replay, False otherwise
116
+ True if replaying historical events, False if executing new logic
115
117
  """
116
- return self.cursor < len(self.history)
117
-
118
- @property
118
+ # We're replaying if we haven't consumed all the original events yet
119
+ return self.cursor < self._original_history_length
119
120
  def is_at_end_of_history(self) -> bool:
120
121
  """Check if we've consumed all events in history.
121
122
 
@@ -40,10 +40,11 @@ class WorkflowLogger:
40
40
  self._log("DEBUG", msg)
41
41
 
42
42
  def _log(self, level: str, msg: str):
43
+ # Only suppress logging if we're actually replaying historical events
43
44
  if self._ctx.is_replaying:
44
45
  return
45
46
 
46
- self._std_logger.info(f"{msg}")
47
+ self._std_logger.info(f"[{self._ctx.id[:8]}] {msg}")
47
48
  asyncio.create_task(self._write_log_to_db(level, msg))
48
49
 
49
50
  async def _write_log_to_db(self, level: str, msg: str):
@@ -32,6 +32,7 @@ class StateProxy(Generic[InputT, StateT]):
32
32
  event = self._ctx._peek()
33
33
  if event and event["type"] == "STATE_SET" and event["payload"]["key"] == name:
34
34
  self._ctx._consume()
35
+ self._data[name] = value
35
36
  return
36
37
 
37
38
  event = ("STATE_SET", {"key": name, "value": value})
@@ -56,6 +57,8 @@ class StateProxy(Generic[InputT, StateT]):
56
57
  payload = event["payload"]
57
58
  if set(payload["values"].keys()) == set(updaters.keys()):
58
59
  self._ctx._consume()
60
+ for key, value in payload["values"].items():
61
+ self._data[key] = value
59
62
  return
60
63
  new_values = {}
61
64
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loom-core
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Durable workflow orchestration engine for Python
5
5
  Home-page: https://github.com/satadeep3927/loom
6
6
  Author: Satadeep Dasgupta
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "loom-core"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "Durable workflow orchestration engine for Python"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes