Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ready(self):
from polyaxon.config_manager import config
config.setup_conf_service()
from polyaxon.config_manager import config
DEFAULT_FROM_EMAIL = config.get_string('POLYAXON_EMAIL_FROM',
is_optional=True,
default='')
EMAIL_HOST = config.get_string('POLYAXON_EMAIL_HOST',
is_optional=True,
default='localhost')
EMAIL_PORT = config.get_int('POLYAXON_EMAIL_PORT',
is_optional=True,
default=25)
EMAIL_HOST_USER = config.get_string('POLYAXON_EMAIL_HOST_USER',
is_optional=True,
default='')
EMAIL_HOST_PASSWORD = config.get_string('POLYAXON_EMAIL_HOST_PASSWORD',
is_optional=True,
is_secret=True,
default='')
EMAIL_SUBJECT_PREFIX = config.get_string('POLYAXON_EMAIL_SUBJECT_PREFIX',
from polyaxon.config_manager import config
INTEGRATIONS_MATTERMOST_WEBHOOKS = config.get_dict('POLYAXON_INTEGRATIONS_HIPCHAT_WEBHOOKS',
is_list=True,
is_optional=True,
is_local=True)
import json
import django_auth_ldap.config as django_auth_ldap_config
import ldap
from polyaxon.config_manager import config
DEFAULT_EMAIL_DOMAIN = 'local_polyaxon.com'
AUTH_LDAP_ENABLED = config.get_boolean('POLYAXON_AUTH_LDAP', is_optional=True, is_local=True)
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
]
ACCESS_BACKEND = config.get_string('POLYAXON_ACCESS_BACKEND', is_optional=True)
if AUTH_LDAP_ENABLED:
AUTHENTICATION_BACKENDS = ['django_auth_ldap.backend.LDAPBackend'] + AUTHENTICATION_BACKENDS
AUTH_LDAP_SERVER_URI = config.get_string('POLYAXON_AUTH_LDAP_SERVER_URI')
# set ldap global options
ldap_global_options = config.get_string('POLYAXON_AUTH_LDAP_GLOBAL_OPTIONS', is_optional=True)
if ldap_global_options:
ldap_global_options = json.loads(ldap_global_options)
import redis
from polyaxon.config_manager import config
class RedisPools(object):
JOB_CONTAINERS = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_JOB_CONTAINERS_URL'))
TO_STREAM = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_TO_STREAM_URL'))
SESSIONS = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_SESSIONS_URL'))
EPHEMERAL_TOKENS = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_EPHEMERAL_TOKENS_URL'))
TTL = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_TTL_URL'))
HEARTBEAT = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_HEARTBEAT_URL'))
GROUP_CHECKS = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_GROUP_CHECKS_URL'))
STATUSES = redis.ConnectionPool.from_url(
config.get_redis_url('POLYAXON_REDIS_STATUSES_URL'))
is_optional=True,
default='0.0.0')
PLATFORM_MIN_VERSION = config.get_string('POLYAXON_PLATFORM_MIN_VERSION',
is_optional=True,
default='0.0.0')
PLATFORM_LATEST_VERSION = config.get_string('POLYAXON_PLATFORM_LATEST_VERSION',
is_optional=True,
default='0.0.0')
LIB_MIN_VERSION = config.get_string('POLYAXON_LIB_MIN_VERSION',
is_optional=True,
default='0.0.0')
LIB_LATEST_VERSION = config.get_string('POLYAXON_LIB_LATEST_VERSION',
is_optional=True,
default='0.0.0')
CHART_IS_UPGRADE = config.get_boolean('POLYAXON_CHART_IS_UPGRADE')
CHART_VERSION = config.chart_version
from polyaxon.config_manager import config
PERSISTENCE_REPOS = config.get_dict('POLYAXON_PERSISTENCE_REPOS')
REPOS_MOUNT_PATH = PERSISTENCE_REPOS['mountPath']
REPOS_HOST_PATH = PERSISTENCE_REPOS.get('host_path', REPOS_MOUNT_PATH)
REPOS_CLAIM_NAME = PERSISTENCE_REPOS.get('existingClaim')
from polyaxon.config_manager import config
DEBUG = config.is_debug_mode
POLYAXON_SERVICE = config.service
POLYAXON_ENVIRONMENT = config.env
K8S_NAMESPACE = config.namespace
K8S_NODE_NAME = config.node_name
ENCRYPTION_KEY = config.get_string('POLYAXON_ENCRYPTION_KEY', is_optional=True)
ENCRYPTION_SECRET = config.get_string('POLYAXON_ENCRYPTION_SECRET', is_optional=True)
ENCRYPTION_BACKEND = config.get_string('POLYAXON_ENCRYPTION_BACKEND', is_optional=True)
CONF_BACKEND = config.get_string('POLYAXON_CONF_BACKEND', is_optional=True)
FEATURES_BACKEND = config.get_string('POLYAXON_FEATURES_BACKEND', is_optional=True)
ARCHIVES_ROOT_REPOS = '/tmp/archived_repos'
ARCHIVES_ROOT_ARTIFACTS = '/tmp/archived_outputs'
ARCHIVES_ROOT_LOGS = '/tmp/archived_logs'
DOWNLOADS_ROOT_ARTIFACTS = '/tmp/download_outputs'
DOWNLOADS_ROOT_LOGS = '/tmp/download_logs'
FILE_UPLOAD_PERMISSIONS = 0o644
ADMIN_VIEW_ENABLED = config.get_boolean('POLYAXON_ADMIN_VIEW_ENABLED',
is_optional=True,
default=False)
# Auditor backend
AUDITOR_BACKEND = config.get_string('POLYAXON_AUDITOR_BACKEND', is_optional=True)
def get_allowed_hosts():
allowed_hosts = config.get_string('POLYAXON_ALLOWED_HOSTS',
is_optional=True,
from polyaxon.config_manager import config
TTL_WATCH_STATUSES = config.get_int('POLYAXON_TTL_WATCH_STATUSES',
is_optional=True,
default=60 * 20)
def retrieve(self, request, *args, **kwargs):
cli_version = CliVersionConfig.obj_to_dict(CliVersion.load())
chart_version = ChartVersionConfig.obj_to_dict(ChartVersion.load())
platform_version = PlatformVersionConfig.obj_to_dict(PlatformVersion.load())
handler_config = LogHandlerConfig(
dsn=config.cli_dsn,
environment=config.env,
tags={
'cli_min_version': cli_version['min_version'],
'cli_latest_version': cli_version['latest_version'],
'platform_min_version': platform_version['min_version'],
'platform_latest_version': platform_version['latest_version'],
'chart_version': chart_version['version']
}
)
return Response(handler_config.to_dict())