Skip to content

Commit

Permalink
feat: add new environment variables (#26)
Browse files Browse the repository at this point in the history
There were several new environment variables added to Actors over time,
this adds them to the constants here.
  • Loading branch information
fnesveda authored Dec 5, 2024
1 parent b6ee7a7 commit 55a8542
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Changelog

## [1.2.0](../../releases/tag/v1.2.0) - 2024-12-05

### Added

- Added new environment variables

## [1.1.2](../../releases/tag/v1.1.2) - 2024-07-04

### Added

- Added constants for Actor Standby

## [1.1.1](../../releases/tag/v1.1.1) - 2024-01-08
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Currently, there is no explicit approval process, so when you are done with the

Once released, manually bump the version in `pyproject.toml` ([commit example](https://github.com/apify/apify-shared-python/commit/24a269bcf046df7202a8652ee788ffe9a461e58b)).

## Maintanance
## Maintenance

### Removing Support for an outdated Python version

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "apify_shared"
version = "1.1.2"
version = "1.2.0"
description = "Tools and constants shared across Apify projects."
readme = "README.md"
license = { text = "Apache Software License" }
Expand Down
16 changes: 15 additions & 1 deletion src/apify_shared/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class ActorEnvVars(str, Enum):
BUILD_ID = 'ACTOR_BUILD_ID'
#: BUILD_NUMBER
BUILD_NUMBER = 'ACTOR_BUILD_NUMBER'
#: BUILD_TAGS
BUILD_TAGS = 'ACTOR_BUILD_TAGS'
#: DEFAULT_DATASET_ID
DEFAULT_DATASET_ID = 'ACTOR_DEFAULT_DATASET_ID'
#: DEFAULT_KEY_VALUE_STORE_ID
Expand All @@ -78,18 +80,24 @@ class ActorEnvVars(str, Enum):
DEFAULT_REQUEST_QUEUE_ID = 'ACTOR_DEFAULT_REQUEST_QUEUE_ID'
#: EVENTS_WEBSOCKET_URL
EVENTS_WEBSOCKET_URL = 'ACTOR_EVENTS_WEBSOCKET_URL'
#: FULL_NAME
FULL_NAME = 'ACTOR_FULL_NAME'
#: ID
ID = 'ACTOR_ID'
#: INPUT_KEY
INPUT_KEY = 'ACTOR_INPUT_KEY'
#: MAX_PAID_DATASET_ITEMS
MAX_PAID_DATASET_ITEMS = 'ACTOR_MAX_PAID_DATASET_ITEMS'
#: MAX_TOTAL_CHARGE_USD
MAX_TOTAL_CHARGE_USD = 'ACTOR_MAX_TOTAL_CHARGE_USD'
#: MEMORY_MBYTES
MEMORY_MBYTES = 'ACTOR_MEMORY_MBYTES'
#: RUN_ID
RUN_ID = 'ACTOR_RUN_ID'
#: STANDBY_PORT
STANDBY_PORT = 'ACTOR_STANDBY_PORT'
#: STANDBY_URL
STANDBY_URL = 'ACTOR_STANDBY_URL'
#: STARTED_AT
STARTED_AT = 'ACTOR_STARTED_AT'
#: TASK_ID
Expand Down Expand Up @@ -285,7 +293,10 @@ class MetaOrigin(str, Enum):

INTEGER_ENV_VARS: list[INTEGER_ENV_VARS_TYPE] = list(get_args(INTEGER_ENV_VARS_TYPE))

FLOAT_ENV_VARS_TYPE = Literal[ApifyEnvVars.MAX_USED_CPU_RATIO,]
FLOAT_ENV_VARS_TYPE = Literal[
ActorEnvVars.MAX_TOTAL_CHARGE_USD,
ApifyEnvVars.MAX_USED_CPU_RATIO,
]

FLOAT_ENV_VARS: list[FLOAT_ENV_VARS_TYPE] = list(get_args(FLOAT_ENV_VARS_TYPE))

Expand Down Expand Up @@ -316,13 +327,16 @@ class MetaOrigin(str, Enum):
# Actor env vars
ActorEnvVars.BUILD_ID,
ActorEnvVars.BUILD_NUMBER,
ActorEnvVars.BUILD_TAGS,
ActorEnvVars.DEFAULT_DATASET_ID,
ActorEnvVars.DEFAULT_KEY_VALUE_STORE_ID,
ActorEnvVars.DEFAULT_REQUEST_QUEUE_ID,
ActorEnvVars.EVENTS_WEBSOCKET_URL,
ActorEnvVars.FULL_NAME,
ActorEnvVars.ID,
ActorEnvVars.INPUT_KEY,
ActorEnvVars.RUN_ID,
ActorEnvVars.STANDBY_URL,
ActorEnvVars.TASK_ID,
ActorEnvVars.WEB_SERVER_URL,
# Apify env vars
Expand Down

0 comments on commit 55a8542

Please sign in to comment.