Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from polyaxon.config_manager import ROOT_DIR, config
MEDIA_ROOT = config.get_string('POLYAXON_MEDIA_ROOT')
MEDIA_URL = config.get_string('POLYAXON_MEDIA_URL')
STATIC_ROOT = config.get_string('POLYAXON_STATIC_ROOT')
STATIC_URL = config.get_string('POLYAXON_STATIC_URL')
# Additional locations of static files
STATICFILES_DIRS = (
ROOT_DIR.child('client').child('public'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
import json
from polyaxon.config_manager import config
UPLOAD_ROOT = config.get_string('POLYAXON_MOUNT_PATHS_UPLOAD')
DATA_ROOT = config.get_string('POLYAXON_MOUNT_PATHS_DATA')
LOGS_ROOT = config.get_string('POLYAXON_MOUNT_PATHS_LOGS')
OUTPUTS_ROOT = config.get_string('POLYAXON_MOUNT_PATHS_OUTPUTS')
REPOS_ROOT = config.get_string('POLYAXON_MOUNT_PATHS_REPOS')
UPLOAD_CLAIM_NAME = config.get_string('POLYAXON_CLAIM_NAMES_UPLOAD')
DATA_CLAIM_NAME = config.get_string('POLYAXON_CLAIM_NAMES_DATA')
LOGS_CLAIM_NAME = config.get_string('POLYAXON_CLAIM_NAMES_LOGS')
OUTPUTS_CLAIM_NAME = config.get_string('POLYAXON_CLAIM_NAMES_OUTPUTS')
REPOS_CLAIM_NAME = config.get_string('POLYAXON_CLAIM_NAMES_REPOS')
# TODO: integrate subpaths
UPLOAD_SUB_PATHS = config.get_string('POLYAXON_SUB_PATHS_UPLOAD', is_optional=True)
DATA_SUB_PATHS = config.get_string('POLYAXON_SUB_PATHS_DATA', is_optional=True)
LOGS_SUB_PATHS = config.get_string('POLYAXON_SUB_PATHS_LOGS', is_optional=True)
OUTPUTS_SUB_PATHS = config.get_string('POLYAXON_SUB_PATHS_OUTPUTS', is_optional=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)
for option_name in ldap_global_options:
option = getattr(ldap, option_name)
ldap.set_option(option, ldap_global_options[option_name])
# set ldap connection options
AUTH_LDAP_CONNECTION_OPTIONS = {}
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():
from polyaxon.config_manager import config
ADMIN_BACKEND = config.get_string('POLYAXON_ADMIN_BACKEND', is_optional=True)
ADMIN_MODELS = config.get_string('POLYAXON_ADMIN_MODELS', is_list=True, is_optional=True)
admin_name = config.get_string('POLYAXON_ADMIN_NAME', is_optional=True)
admin_mail = config.get_string('POLYAXON_ADMIN_MAIL', is_optional=True)
if admin_mail and admin_mail:
ADMINS = (
(admin_name, admin_mail),
)
MANAGERS = ADMINS
from polyaxon.config_manager import config
CLI_MIN_VERSION = config.get_string('POLYAXON_CLI_MIN_VERSION',
is_optional=True,
default='0.0.0')
CLI_LATEST_VERSION = config.get_string('POLYAXON_CLI_LATEST_VERSION',
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
PIPELINES_HEALTH = config.get_string('POLYAXON_QUEUES_PIPELINES_HEALTH')
PIPELINES = config.get_string('POLYAXON_QUEUES_PIPELINES')
CRONS_HEALTH = config.get_string('POLYAXON_QUEUES_CRONS_HEALTH')
CRONS_HEARTBEAT = config.get_string('POLYAXON_QUEUES_CRONS_HEARTBEAT')
CRONS_EXPERIMENTS = config.get_string('POLYAXON_QUEUES_CRONS_EXPERIMENTS')
CRONS_PIPELINES = config.get_string('POLYAXON_QUEUES_CRONS_PIPELINES')
CRONS_CLUSTERS = config.get_string('POLYAXON_QUEUES_CRONS_CLUSTERS')
CRONS_CLEAN = config.get_string('POLYAXON_QUEUES_CRONS_CLEAN')
HP_HEALTH = config.get_string('POLYAXON_QUEUES_HP_HEALTH')
HP = config.get_string('POLYAXON_QUEUES_HP')
EVENTS_HEALTH = config.get_string('POLYAXON_QUEUES_EVENTS_HEALTH')
EVENTS_NOTIFY = config.get_string('POLYAXON_QUEUES_EVENTS_NOTIFY')
EVENTS_LOG = config.get_string('POLYAXON_QUEUES_EVENTS_LOG')
EVENTS_TRACK = config.get_string('POLYAXON_QUEUES_EVENTS_TRACK')
K8S_EVENTS_HEALTH = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_HEALTH')
K8S_EVENTS_NAMESPACE = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_NAMESPACE')
K8S_EVENTS_RESOURCES = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_RESOURCES')
K8S_EVENTS_JOB_STATUSES = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_JOB_STATUSES')
LOGS_HEALTH = config.get_string('POLYAXON_QUEUES_LOGS_HEALTH')
LOGS_SIDECARS = config.get_string('POLYAXON_QUEUES_LOGS_SIDECARS')
STREAM_LOGS_SIDECARS = config.get_string('POLYAXON_QUEUES_STREAM_LOGS_SIDECARS')
# Queues on non default exchange
CELERY_TASK_QUEUES = (
# Streams
Queue(CeleryQueues.STREAM_LOGS_SIDECARS,
CLI_MIN_VERSION = config.get_string('POLYAXON_CLI_MIN_VERSION',
is_optional=True,
default='0.0.0')
CLI_LATEST_VERSION = config.get_string('POLYAXON_CLI_LATEST_VERSION',
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
is_optional=True,
default='queues.events.notify')
EVENTS_LOG = config.get_string('POLYAXON_QUEUES_EVENTS_LOG',
is_optional=True,
default='queues.events.log')
EVENTS_TRACK = config.get_string('POLYAXON_QUEUES_EVENTS_TRACK',
is_optional=True,
default='queues.events.track')
K8S_EVENTS_HEALTH = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_HEALTH',
is_optional=True,
default='queues.k8s_events.health')
K8S_EVENTS_NAMESPACE = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_NAMESPACE',
is_optional=True,
default='queues.k8s_events.namespace')
K8S_EVENTS_RESOURCES = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_RESOURCES',
is_optional=True,
default='queues.k8s_events.resources')
K8S_EVENTS_JOB_STATUSES = config.get_string('POLYAXON_QUEUES_K8S_EVENTS_JOB_STATUSES',
is_optional=True,
default='queues.k8s_events.jobStatuses')
LOGS_HEALTH = config.get_string('POLYAXON_QUEUES_LOGS_HEALTH',
is_optional=True,
default='queues.logs.health')
LOGS_HANDLERS = config.get_string('POLYAXON_QUEUES_LOGS_SIDECARS',
is_optional=True,
default='queues.logs.handler')
LOGS_SIDECARS = config.get_string('POLYAXON_QUEUES_LOGS_HANDLERS',
is_optional=True,
default='queues.logs.sidecars')
STREAM_LOGS_SIDECARS = config.get_string('POLYAXON_QUEUES_STREAM_LOGS_SIDECARS',
ldap_global_options = json.loads(ldap_global_options)
for option_name in ldap_global_options:
option = getattr(ldap, option_name)
ldap.set_option(option, ldap_global_options[option_name])
# set ldap connection options
AUTH_LDAP_CONNECTION_OPTIONS = {}
ldap_conn_options = config.get_string('POLYAXON_AUTH_LDAP_CONNECTION_OPTIONS', is_optional=True)
if ldap_conn_options:
ldap_conn_options = json.loads(ldap_conn_options)
for option_name in ldap_conn_options:
option = getattr(ldap, option_name)
AUTH_LDAP_CONNECTION_OPTIONS[option] = ldap_conn_options[option_name]
AUTH_LDAP_BIND_DN = config.get_string('POLYAXON_AUTH_LDAP_BIND_DN', is_optional=True)
AUTH_LDAP_BIND_PASSWORD = config.get_string('POLYAXON_AUTH_LDAP_BIND_PASSWORD',
is_secret=True,
is_optional=True)
base_dn = config.get_string('POLYAXON_AUTH_LDAP_USER_SEARCH_BASE_DN', is_optional=True)
filterstr = config.get_string('POLYAXON_AUTH_LDAP_USER_SEARCH_FILTERSTR', is_optional=True)
if base_dn and filterstr:
AUTH_LDAP_USER_SEARCH = django_auth_ldap_config.LDAPSearch(
base_dn,
ldap.SCOPE_SUBTREE,
filterstr
)
AUTH_LDAP_USER_DN_TEMPLATE = config.get_string('POLYAXON_AUTH_LDAP_USER_DN_TEMPLATE',
is_optional=True)
# when USER_DN_TEMPLATE is empty string, all users will login as anonymous user.
if AUTH_LDAP_USER_DN_TEMPLATE == '':
AUTH_LDAP_USER_DN_TEMPLATE = None