Skip to content

Commit

Permalink
Applied CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPeczek-Roboflow committed Oct 4, 2024
1 parent 82fb825 commit 480bc62
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/server_configuration/environmental_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Environmental variable | Description
`WORKFLOWS_PROFILER_BUFFER_SIZE` | Size of profiler buffer (number of consecutive Wrofklows Execution Engine `run(...)` invocations to trace in buffer. | 64
`ENABLE_STREAM_API` | Flag to enable Stream Management API in `inference` server - see [more](/workflows/video_processing/overview/). | False
`RUNS_ON_JETSON` | Boolean flag to tell if `inference` runs on Jetson device - set to `True` in all docker builds for Jetson architecture. | False
`WORKFLOWS_DEFINITION_CACHE_EXPIRY` | Number of seconds to cache Workflows definitions as a result of `get_workflow_specification(...)` function call | `15 * 60` - 15 minutes
4 changes: 2 additions & 2 deletions inference/core/entities/requests/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WorkflowInferenceRequest(BaseModel):
class PredefinedWorkflowInferenceRequest(WorkflowInferenceRequest):
use_cache: bool = Field(
default=True,
description="Controls usage of cache for workflow definitions. Set this into False when you frequently modify "
description="Controls usage of cache for workflow definitions. Set this to False when you frequently modify "
"definition saved in Roboflow app and want to fetch the newest version for the request.",
)

Expand Down Expand Up @@ -63,7 +63,7 @@ class DescribeInterfaceRequest(BaseModel):
class PredefinedWorkflowDescribeInterfaceRequest(DescribeInterfaceRequest):
use_cache: bool = Field(
default=True,
description="Controls usage of cache for workflow definitions. Set this into False when you frequently modify "
description="Controls usage of cache for workflow definitions. Set this to False when you frequently modify "
"definition saved in Roboflow app and want to fetch the newest version for the request. "
"Only applies for Workflows definitions saved on Roboflow platform.",
)
Expand Down
3 changes: 3 additions & 0 deletions inference/core/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,6 @@

ENABLE_WORKFLOWS_PROFILING = str2bool(os.getenv("ENABLE_WORKFLOWS_PROFILING", "False"))
WORKFLOWS_PROFILER_BUFFER_SIZE = int(os.getenv("WORKFLOWS_PROFILER_BUFFER_SIZE", "64"))
WORKFLOWS_DEFINITION_CACHE_EXPIRY = int(
os.getenv("WORKFLOWS_DEFINITION_CACHE_EXPIRY", 15 * 60)
)
2 changes: 1 addition & 1 deletion inference/core/interfaces/stream/inference_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def init_with_workflow(
export `ENABLE_WORKFLOWS_PROFILING=True` environmental variable. You may specify number of workflow
runs in a buffer with environmental variable `WORKFLOWS_PROFILER_BUFFER_SIZE=n` - making last `n`
frames to be present in buffer on processing end.
use_workflow_definition_cache (bool): Controls usage of cache for workflow definitions. Set this into False
use_workflow_definition_cache (bool): Controls usage of cache for workflow definitions. Set this to False
when you frequently modify definition saved in Roboflow app and want to fetch the
newest version for the request. Only applies for Workflows definitions saved on Roboflow platform.
Other ENV variables involved in low-level configuration:
Expand Down
8 changes: 6 additions & 2 deletions inference/core/roboflow_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
VersionID,
WorkspaceID,
)
from inference.core.env import API_BASE_URL, MODEL_CACHE_DIR
from inference.core.env import (
API_BASE_URL,
MODEL_CACHE_DIR,
WORKFLOWS_DEFINITION_CACHE_EXPIRY,
)
from inference.core.exceptions import (
MalformedRoboflowAPIResponseError,
MalformedWorkflowResponseError,
Expand Down Expand Up @@ -517,7 +521,7 @@ def _cache_workflow_specification_in_ephemeral_cache(
ephemeral_cache.set(
key=cache_key,
value=specification,
expire=15 * 60,
expire=WORKFLOWS_DEFINITION_CACHE_EXPIRY,
)


Expand Down

0 comments on commit 480bc62

Please sign in to comment.