Skip to content

Commit

Permalink
Merge branch 'dev' into c/bump-cozo-ce-version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad-mtos committed Dec 7, 2024
2 parents fa8c171 + 277a24d commit 78d45b6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,11 @@ MAX_FREE_EXECUTIONS=50
# ------------

# INTEGRATIONS_SERVICE_PORT=8000
# INTEGRATIONS_SENTRY_DSN=<sentry_dsn>
# INTEGRATIONS_SENTRY_DSN=<sentry_dsn>

# Temporal fine tuning

# TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASKS=5
# TEMPORAL_MAX_CONCURRENT_ACTIVITIES=5
# TEMPORAL_MAX_ACTIVITIES_PER_SECOND=5
# TEMPORAL_MAX_TASK_QUEUE_ACTIVITIES_PER_SECOND=5
12 changes: 12 additions & 0 deletions agents-api/agents_api/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
temporal_activity_after_retry_timeout: int = env.int(
"TEMPORAL_ACTIVITY_AFTER_RETRY_TIMEOUT", default=30
)
temporal_max_concurrent_workflow_tasks: int = env.int(
"TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASKS", default=5
)
temporal_max_concurrent_activities: int = env.int(
"TEMPORAL_MAX_CONCURRENT_ACTIVITIES", default=5
)
temporal_max_activities_per_second: int = env.int(
"TEMPORAL_MAX_ACTIVITIES_PER_SECOND", default=5
)
temporal_max_task_queue_activities_per_second: int = env.int(
"TEMPORAL_MAX_TASK_QUEUE_ACTIVITIES_PER_SECOND", default=5
)

# Consolidate environment variables
environment: Dict[str, Any] = dict(
Expand Down
14 changes: 10 additions & 4 deletions agents-api/agents_api/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
from temporalio.client import Client
from temporalio.worker import Worker

MAX_CONCURRENT_WORKFLOW_TASKS = None # default None
MAX_CONCURRENT_ACTIVITIES = 100 # default None
from ..env import (
temporal_max_activities_per_second,
temporal_max_concurrent_activities,
temporal_max_concurrent_workflow_tasks,
temporal_max_task_queue_activities_per_second,
)


def create_worker(client: Client) -> Any:
Expand Down Expand Up @@ -69,8 +73,10 @@ def create_worker(client: Client) -> Any:
load_inputs_remote,
],
interceptors=[CustomInterceptor()],
max_concurrent_workflow_tasks=MAX_CONCURRENT_WORKFLOW_TASKS,
max_concurrent_activities=MAX_CONCURRENT_ACTIVITIES,
max_concurrent_workflow_tasks=temporal_max_concurrent_workflow_tasks,
max_concurrent_activities=temporal_max_concurrent_activities,
max_activities_per_second=temporal_max_activities_per_second,
max_task_queue_activities_per_second=temporal_max_task_queue_activities_per_second,
)

return worker
4 changes: 4 additions & 0 deletions agents-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ x--shared-environment: &shared-environment
TEMPORAL_METRICS_BIND_PORT: ${TEMPORAL_METRICS_BIND_PORT:-14000}
TEMPORAL_HEARTBEAT_TIMEOUT: ${TEMPORAL_HEARTBEAT_TIMEOUT:-900}
TEMPORAL_ACTIVITY_AFTER_RETRY_TIMEOUT: ${TEMPORAL_ACTIVITY_AFTER_RETRY_TIMEOUT:-30}
TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASKS: ${TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASKS:-5}
TEMPORAL_MAX_CONCURRENT_ACTIVITIES: ${TEMPORAL_MAX_CONCURRENT_ACTIVITIES:-5}
TEMPORAL_MAX_ACTIVITIES_PER_SECOND: ${TEMPORAL_MAX_ACTIVITIES_PER_SECOND:-5}
TEMPORAL_MAX_TASK_QUEUE_ACTIVITIES_PER_SECOND: ${TEMPORAL_MAX_TASK_QUEUE_ACTIVITIES_PER_SECOND:-5}
TRUNCATE_EMBED_TEXT: ${TRUNCATE_EMBED_TEXT:-True}
WORKER_URL: ${WORKER_URL:-temporal:7233}
USE_BLOB_STORE_FOR_TEMPORAL: ${USE_BLOB_STORE_FOR_TEMPORAL:-false}
Expand Down

0 comments on commit 78d45b6

Please sign in to comment.