logger.info(f"Service '{service_name}' running in standalone mode")
standalone=True
# TODO: We are signaling by setting env vars to downstream subprocesses. Let's pass flags on our invokation of serve_dynamo instead. That way the API is defined at the top level.
# Signal downstream workers to start system app by setting DYNAMO_SYSTEM_APP_* env vars for each worker. They are respectively consumed in serve_dynamo.py
ifenable_system_app:
env["DYNAMO_SYSTEM_APP_ENABLED"]="true"
ifsystem_app_port:
# Throw if not standalone mode. Should only be set in standalone mode.
# TODO: This might still cause issues if we are running in standalone, but have multiple workers, need to figure this one out
ifnotstandalone:
raiseValueError(
"Specifying system app port is only supported in standalone mode (i.e --service-name is set)"
# env is the base dynamlocal fault tolerence o environment variables. We make a copy and update it to add any service configurations and additional env vars
"""Link this service to another service, creating a pipeline.
This method allows linking (injecting) a concrete service implementation by checking if there is a dependency that next_service implements/inherits from.
Args:
next_service: The concrete service implementation to link
Returns:
The next_service that was linked to this service
Raises:
ValueError: If no matching interface is found or if multiple matches are found
"""
ifnotisinstance(next_service,ServiceInterface):
raiseValueError(f"link must be passed a Service, got {type(next_service)}")
# Get all the deps of the service
inner_deps=[
(dep.on.inner,dep_key,dep)
fordep_key,depinself.dependencies.items()
ifdep.onisnotNone
]# type: ignore
# Get the inner class of the passed in service
curr_inner=next_service.inner
# Find deps that next_service implements/inherits from
# TODO: These defaults should be set by the provider. For now, I'm just adding them so that something is exposed when we do --use-default-health-checks
defdefault_liveness_check()->bool:
"""Default liveness check that always returns True."""
returnTrue
defdefault_readiness_check()->bool:
"""Default readiness check that always returns True."""