Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ build-backend = "setuptools.build_meta"

[project]
name = "julee"
version = "0.1.8"
version = "0.1.9"
description = "Julee - Clean architecture for accountable and transparent digital supply chains"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "GPL-3.0"}
license = "GPL-3.0"
authors = [
{name = "Pyx Industries", email = "chris@pyx.io"}
]
keywords = ["temporal", "workflow", "document-processing", "ai", "supply-chain"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",

"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
2 changes: 1 addition & 1 deletion src/julee/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Julee - Clean architecture for accountable and transparent digital supply chains."""

__version__ = "0.1.8"
__version__ = "0.1.9"
2 changes: 1 addition & 1 deletion src/julee/contrib/polling/domain/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
No re-exports to avoid import chains that pull non-deterministic code
into Temporal workflows. Import directly from specific modules:

- from julee.contrib.polling.domain.models.polling_config import PollingConfig, PollingProtocol, PollingResult
- from julee.contrib.polling.domain.models.polling_config import PollingConfig, PollingProtocol, PollingResult, SchedulingPolicy
"""

__all__ = []
11 changes: 11 additions & 0 deletions src/julee/contrib/polling/domain/models/polling_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class PollingProtocol(str, Enum):
HTTP = "http"


class SchedulingPolicy(str, Enum):
"""Scheduling policy for polling operations."""

ALLOW_OVERLAP = "allow_overlap"
SKIP_IF_RUNNING = "skip_if_running"


class PollingConfig(BaseModel):
"""Configuration for a polling operation."""

Expand All @@ -26,6 +33,10 @@ class PollingConfig(BaseModel):
connection_params: dict[str, Any] = Field(default_factory=dict)
polling_params: dict[str, Any] = Field(default_factory=dict)
timeout_seconds: int | None = Field(default=30)
scheduling_policy: SchedulingPolicy = Field(
default=SchedulingPolicy.ALLOW_OVERLAP,
description="Policy for handling overlapping polling operations",
)


class PollingResult(BaseModel):
Expand Down
15 changes: 14 additions & 1 deletion src/julee/contrib/polling/infrastructure/temporal/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
ScheduleActionStartWorkflow,
ScheduleAlreadyRunningError,
ScheduleIntervalSpec,
ScheduleOverlapPolicy,
SchedulePolicy,
ScheduleSpec,
ScheduleUpdate,
ScheduleUpdateInput,
)

from julee.contrib.polling.domain.models.polling_config import PollingConfig
from julee.contrib.polling.domain.models.polling_config import (
PollingConfig,
SchedulingPolicy,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -99,6 +104,13 @@ async def start_polling(

schedule_id = f"poll-{endpoint_id}"

# Map Julee scheduling policy to Temporal overlap policy
temporal_overlap_policy = (
ScheduleOverlapPolicy.SKIP
if config.scheduling_policy == SchedulingPolicy.SKIP_IF_RUNNING
else ScheduleOverlapPolicy.ALLOW_ALL
)

schedule = Schedule(
action=ScheduleActionStartWorkflow(
"NewDataDetectionPipeline",
Expand All @@ -111,6 +123,7 @@ async def start_polling(
ScheduleIntervalSpec(every=timedelta(seconds=interval_seconds))
]
),
policy=SchedulePolicy(overlap=temporal_overlap_policy),
)

try:
Expand Down