Example #1
0
 class GITHUB(object):
     VERIFICATION_SCHEDULE = 0
     CLIENT_ID = config.get_string('POLYAXON_AUTH_GITHUB_CLIENT_ID',
                                   is_optional=True,
                                   is_secret=True)
     CLIENT_SECRET = config.get_string('POLYAXON_AUTH_GITHUB_CLIENT_SECRET',
                                       is_optional=True,
                                       is_secret=True)
     ENABLED = config.get_boolean('POLYAXON_AUTH_GITHUB',
                                  is_optional=True,
                                  default=False)
Example #2
0
    'POLYAXON_RABBITMQ_PASSWORD', is_secret=True, is_optional=True)
if RABBITMQ_USER and RABBITMQ_PASSWORD:
    CELERY_BROKER_URL = 'amqp://{user}:{password}@{url}'.format(
        user=RABBITMQ_USER,
        password=RABBITMQ_PASSWORD,
        url=AMQP_URL
    )

CELERY_BROKER_URL = 'amqp://{url}'.format(url=AMQP_URL)

INTERNAL_EXCHANGE = config.get_string('POLYAXON_INTERNAL_EXCHANGE')

# CELERY_RESULT_BACKEND = config.get_string('POLYAXON_REDIS_CELERY_RESULT_BACKEND_URL')
CELERYD_PREFETCH_MULTIPLIER = config.get_int('POLYAXON_CELERYD_PREFETCH_MULTIPLIER')

CELERY_TASK_ALWAYS_EAGER = config.get_boolean('POLYAXON_CELERY_ALWAYS_EAGER')
if CELERY_TASK_ALWAYS_EAGER:
    BROKER_TRANSPORT = 'memory'

CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

CELERY_IGNORE_RESULT = True
CELERY_HARD_TIME_LIMIT_DELAY = config.get_int('POLYAXON_CELERY_HARD_TIME_LIMIT_DELAY',
                                              is_optional=True,
                                              default=180)


class Intervals(object):
    """All intervals are in seconds"""
Example #3
0
from polyaxon.config_manager import config

PUBLIC_PLUGIN_JOBS = config.get_boolean('POLYAXON_PUBLIC_PLUGIN_JOBS', is_optional=True)

# k8s
K8S_SERVICE_ACCOUNT_NAME = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_NAME')
K8S_SERVICE_ACCOUNT_EXPERIMENTS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_EXPERIMENTS',
                                                    is_optional=True)
K8S_SERVICE_ACCOUNT_JOBS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_JOBS',
                                             is_optional=True)
K8S_SERVICE_ACCOUNT_BUILDS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_BUILDS',
                                               is_optional=True)
K8S_RBAC_ENABLED = config.get_boolean('POLYAXON_K8S_RBAC_ENABLED')
K8S_PROVISIONER_ENABLED = config.get_boolean('POLYAXON_K8S_PROVISIONER_ENABLED')
K8S_INGRESS_ENABLED = config.get_boolean('POLYAXON_K8S_INGRESS_ENABLED')
K8S_INGRESS_ANNOTATIONS = config.get_string('POLYAXON_K8S_INGRESS_ANNOTATIONS', is_optional=True)

# Builds
BUILD_ALWAYS_PULL_LATEST = config.get_boolean('POLYAXON_BUILD_ALWAYS_PULL_LATEST',
                                              is_optional=True,
                                              default=False)

# Refs
REFS_SECRETS = config.get_string('POLYAXON_REFS_SECRETS',
                                 is_optional=True,
                                 is_list=True,
                                 default=())
REFS_CONFIG_MAPS = config.get_string('POLYAXON_REFS_CONFIG_MAPS',
                                     is_optional=True,
                                     is_list=True,
                                     default=())
Example #4
0
from polyaxon.config_manager import config

ALLOW_USER_PROJECTS = config.get_boolean('POLYAXON_ALLOW_USER_PROJECTS',
                                         is_optional=True,
                                         default=True)
OWNER_TYPES = config.get_string('POLYAXON_OWNER_TYPES',
                                is_optional=True,
                                is_list=True,
                                default=['user'])
ROLES = config.get_dict('POLYAXON_ROLES',
                        is_optional=True,
                        is_list=True,
                        default=[])
DEFAULT_ROLE = config.get_string('POLYAXON_DEFAULT_ROLE',
                                 is_optional=True,
                                 default='dummy')
SCOPE_ROLES = config.get_dict_of_dicts('POLYAXON_SCOPE_ROLES',
                                       is_optional=True,
                                       default={})
Example #5
0
from polyaxon.config_manager import config

PUBLIC_PLUGIN_JOBS = config.get_boolean('POLYAXON_PUBLIC_PLUGIN_JOBS', is_optional=True)

# k8s
K8S_SERVICE_ACCOUNT_NAME = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_NAME')
K8S_SERVICE_ACCOUNT_EXPERIMENTS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_EXPERIMENTS',
                                                    is_optional=True)
K8S_SERVICE_ACCOUNT_JOBS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_JOBS',
                                             is_optional=True)
K8S_SERVICE_ACCOUNT_BUILDS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_BUILDS',
                                               is_optional=True)
K8S_RBAC_ENABLED = config.get_boolean('POLYAXON_K8S_RBAC_ENABLED')
K8S_INGRESS_ENABLED = config.get_boolean('POLYAXON_K8S_INGRESS_ENABLED')
K8S_INGRESS_ANNOTATIONS = config.get_string('POLYAXON_K8S_INGRESS_ANNOTATIONS', is_optional=True)

# Builds
BUILD_ALWAYS_PULL_LATEST = config.get_boolean('POLYAXON_BUILD_ALWAYS_PULL_LATEST',
                                              is_optional=True,
                                              default=False)

# Refs
REFS_SECRETS = config.get_string('POLYAXON_REFS_SECRETS',
                                 is_optional=True,
                                 is_list=True,
                                 default=())
REFS_CONFIG_MAPS = config.get_string('POLYAXON_REFS_CONFIG_MAPS',
                                     is_optional=True,
                                     is_list=True,
                                     default=())
Example #6
0
from polyaxon.config_manager import config

PUBLIC_PLUGIN_JOBS = config.get_boolean('POLYAXON_PUBLIC_PLUGIN_JOBS',
                                        is_optional=True)
# Roles
ROLE_LABELS_WORKER = config.get_string('POLYAXON_ROLE_LABELS_WORKER')
ROLE_LABELS_DASHBOARD = config.get_string('POLYAXON_ROLE_LABELS_DASHBOARD')
ROLE_LABELS_LOG = config.get_string('POLYAXON_ROLE_LABELS_LOG')
ROLE_LABELS_API = config.get_string('POLYAXON_ROLE_LABELS_API')
K8S_SERVICE_ACCOUNT_NAME = config.get_string(
    'POLYAXON_K8S_SERVICE_ACCOUNT_NAME')
K8S_RBAC_ENABLED = config.get_boolean('POLYAXON_K8S_RBAC_ENABLED')
K8S_PROVISIONER_ENABLED = config.get_boolean(
    'POLYAXON_K8S_PROVISIONER_ENABLED')
K8S_INGRESS_ENABLED = config.get_boolean('POLYAXON_K8S_INGRESS_ENABLED')
K8S_INGRESS_ANNOTATIONS = config.get_string('POLYAXON_K8S_INGRESS_ANNOTATIONS',
                                            is_optional=True)
TENSORBOARD_PORT_RANGE = [5700, 6700]
NOTEBOOK_PORT_RANGE = [6700, 7700]

# Types
TYPE_LABELS_CORE = config.get_string('POLYAXON_TYPE_LABELS_CORE')
TYPE_LABELS_RUNNER = config.get_string('POLYAXON_TYPE_LABELS_RUNNER')

# Labels
APP_LABELS_TENSORBOARD = config.get_string('POLYAXON_APP_LABELS_TENSORBOARD',
                                           is_optional=True,
                                           default='polyaxon-tensorboard')
APP_LABELS_NOTEBOOK = config.get_string('POLYAXON_APP_LABELS_NOTEBOOK',
                                        is_optional=True,
                                        default='polyaxon-notebook')
Example #7
0
K8S_NAMESPACE = config.namespace
K8S_NODE_NAME = config.node_name
K8S_GPU_RESOURCE_KEY = config.get_string('POLYAXON_K8S_GPU_RESOURCE_KEY')
K8S_TPU_RESOURCE_KEY = config.get_string('POLYAXON_K8S_TPU_RESOURCE_KEY',
                                         is_optional=True,
                                         default='cloud-tpus.google.com/v2')
CONF_BACKEND = config.get_string('POLYAXON_CONF_BACKEND', is_optional=True)
CLUSTER_ID = config.cluster_id
REPOS_ARCHIVE_ROOT = '/tmp/archived_repos'
OUTPUTS_ARCHIVE_ROOT = '/tmp/archived_outputs'
OUTPUTS_DOWNLOAD_ROOT = '/tmp/download_outputs'
LOGS_DOWNLOAD_ROOT = '/tmp/download_logs'
LOGS_ARCHIVE_ROOT = '/tmp/archived_logs'
FILE_UPLOAD_PERMISSIONS = 0o644
ADMIN_VIEW_ENABLED = config.get_boolean('POLYAXON_ADMIN_VIEW_ENABLED',
                                        is_optional=True,
                                        default=False)
# Global Async Countdown
GLOBAL_COUNTDOWN = config.get_int('POLYAXON_GLOBAL_COUNTDOWN',
                                  is_optional=True,
                                  default=1)
# Heartbeat timeout (status -> failed as zombie)
TTL_HEARTBEAT = config.get_int('POLYAXON_TTL_HEARTBEAT',
                               is_optional=True,
                               default=60 * 30)
# Token time in days
TTL_TOKEN = config.get_int('POLYAXON_TTL_TOKEN',
                           is_optional=True,
                           default=30)
# Ephemeral token ttl
TTL_EPHEMERAL_TOKEN = config.get_int('POLYAXON_TTL_EPHEMERAL_TOKEN',
Example #8
0
from polyaxon.config_manager import config

OAUTH_GITHUB_VERIFICATION_SCHEDULE = config.get_int(
    'POLYAXON_AUTH_GITHUB_VERIFICATION_SCHEDULE', is_optional=True, default=0)
OAUTH_GITHUB_CLIENT_ID = config.get_string('POLYAXON_AUTH_GITHUB_CLIENT_ID',
                                           is_optional=True,
                                           is_secret=True)
OAUTH_GITHUB_CLIENT_SECRET = config.get_string(
    'POLYAXON_AUTH_GITHUB_CLIENT_SECRET', is_optional=True, is_secret=True)
OAUTH_GITHUB_ENABLED = config.get_boolean('POLYAXON_AUTH_GITHUB',
                                          is_optional=True,
                                          default=False)

OAUTH_BITBUCKET_VERIFICATION_SCHEDULE = config.get_int(
    'POLYAXON_AUTH_BITBUCKET_VERIFICATION_SCHEDULE',
    is_optional=True,
    default=0)
OAUTH_BITBUCKET_CLIENT_ID = config.get_string(
    'POLYAXON_AUTH_BITBUCKET_CLIENT_ID', is_optional=True, is_secret=True)
OAUTH_BITBUCKET_CLIENT_SECRET = config.get_string(
    'POLYAXON_AUTH_BITBUCKET_CLIENT_SECRET', is_optional=True, is_secret=True)
OAUTH_BITBUCKET_ENABLED = config.get_boolean('POLYAXON_AUTH_BITBUCKET',
                                             is_optional=True,
                                             default=False)

OAUTH_GITLAB_VERIFICATION_SCHEDULE = config.get_int(
    'POLYAXON_AUTH_GITLAB_VERIFICATION_SCHEDULE', is_optional=True, default=0)
OAUTH_GITLAB_URL = config.get_string('POLYAXON_AUTH_GITLAB_URL',
                                     is_optional=True,
                                     is_secret=True)
OAUTH_GITLAB_CLIENT_ID = config.get_string('POLYAXON_AUTH_GITLAB_CLIENT_ID',
Example #9
0
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
Example #10
0
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',
]

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])
Example #11
0
from polyaxon.config_manager import config

PUBLIC_PLUGIN_JOBS = config.get_boolean('POLYAXON_PUBLIC_PLUGIN_JOBS', is_optional=True)

# k8s
K8S_SERVICE_ACCOUNT_NAME = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_NAME')
K8S_SERVICE_ACCOUNT_EXPERIMENTS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_EXPERIMENTS',
                                                    is_optional=True)
K8S_SERVICE_ACCOUNT_JOBS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_JOBS',
                                             is_optional=True)
K8S_SERVICE_ACCOUNT_BUILDS = config.get_string('POLYAXON_K8S_SERVICE_ACCOUNT_BUILDS',
                                               is_optional=True)
K8S_RBAC_ENABLED = config.get_boolean('POLYAXON_K8S_RBAC_ENABLED')
K8S_INGRESS_ENABLED = config.get_boolean('POLYAXON_K8S_INGRESS_ENABLED')
K8S_INGRESS_ANNOTATIONS = config.get_string('POLYAXON_K8S_INGRESS_ANNOTATIONS', is_optional=True)

# Builds
BUILD_ALWAYS_PULL_LATEST = config.get_boolean('POLYAXON_BUILD_ALWAYS_PULL_LATEST',
                                              is_optional=True,
                                              default=False)

# Refs
REFS_SECRETS = config.get_string('POLYAXON_REFS_SECRETS',
                                 is_optional=True,
                                 is_list=True,
                                 default=())
REFS_CONFIG_MAPS = config.get_string('POLYAXON_REFS_CONFIG_MAPS',
                                     is_optional=True,
                                     is_list=True,
                                     default=())
Example #12
0
from polyaxon.config_manager import config

PUBLIC_PLUGIN_JOBS = config.get_boolean('POLYAXON_PUBLIC_PLUGIN_JOBS',
                                        is_optional=True)

# k8s
K8S_SERVICE_ACCOUNT_NAME = config.get_string(
    'POLYAXON_K8S_SERVICE_ACCOUNT_NAME')
K8S_SERVICE_ACCOUNT_EXPERIMENTS = config.get_string(
    'POLYAXON_K8S_SERVICE_ACCOUNT_EXPERIMENTS', is_optional=True)
K8S_SERVICE_ACCOUNT_JOBS = config.get_string(
    'POLYAXON_K8S_SERVICE_ACCOUNT_JOBS', is_optional=True)
K8S_SERVICE_ACCOUNT_BUILDS = config.get_string(
    'POLYAXON_K8S_SERVICE_ACCOUNT_BUILDS', is_optional=True)
K8S_RBAC_ENABLED = config.get_boolean('POLYAXON_K8S_RBAC_ENABLED')
K8S_INGRESS_ENABLED = config.get_boolean('POLYAXON_K8S_INGRESS_ENABLED')
K8S_INGRESS_ANNOTATIONS = config.get_string('POLYAXON_K8S_INGRESS_ANNOTATIONS',
                                            is_optional=True)

# Refs
REFS_SECRETS = config.get_string('POLYAXON_REFS_SECRETS',
                                 is_optional=True,
                                 is_list=True,
                                 default=())
REFS_CONFIG_MAPS = config.get_string('POLYAXON_REFS_CONFIG_MAPS',
                                     is_optional=True,
                                     is_list=True,
                                     default=())

# DNS Cluster
DNS_USE_RESOLVER = config.get_boolean('POLYAXON_DNS_USE_RESOLVER',
Example #13
0
from polyaxon.config_manager import ROOT_DIR, config

if config.is_monolith_service or config.is_api_service:
    LIST_TEMPLATE_CONTEXT_PROCESSORS = [
        'django.contrib.auth.context_processors.auth',
        'django.template.context_processors.debug',
        'django.template.context_processors.media',
        'django.template.context_processors.static',
        'django.template.context_processors.tz',
        'django.contrib.messages.context_processors.messages',
        'polyaxon.context_processors.versions',
        'polyaxon.context_processors.cluster',
        'api.context_processors.sso_enabled',
    ]

    JS_DEBUG = config.get_boolean('POLYAXON_JS_DEBUG')

    if JS_DEBUG:
        def js_debug_processor(request):
            return {'js_debug': True}

        LIST_TEMPLATE_CONTEXT_PROCESSORS += ('polyaxon.settings.js_debug_processor',)

else:
    LIST_TEMPLATE_CONTEXT_PROCESSORS = [
        'django.contrib.auth.context_processors.auth',
        'polyaxon.context_processors.versions',
        'polyaxon.context_processors.cluster',
    ]

TEMPLATES_DEBUG = (config.get_boolean('DJANGO_TEMPLATE_DEBUG', is_optional=True) or
Example #14
0
from datetime import timedelta

from kombu import Exchange, Queue

from polyaxon.config_manager import config

CELERY_TASK_TRACK_STARTED = config.get_boolean(
    'POLYAXON_CELERY_TASK_TRACK_STARTED', is_optional=True, default=True)

CELERY_BROKER_POOL_LIMIT = config.get_int('POLYAXON_CELERY_BROKER_POOL_LIMIT',
                                          is_optional=True,
                                          default=100)

CELERY_BROKER_BACKEND = config.broker_backend
CELERY_CONFIRM_PUBLISH = config.get_boolean('POLYAXON_CELERY_CONFIRM_PUBLISH',
                                            is_optional=True,
                                            default=True)
if config.is_rabbitmq_broker and CELERY_CONFIRM_PUBLISH:
    # see https://github.com/celery/celery/issues/5410 for details
    CELERY_BROKER_TRANSPORT_OPTIONS = {'confirm_publish': True}

CELERY_BROKER_URL = config.get_broker_url()

INTERNAL_EXCHANGE = config.get_string('POLYAXON_INTERNAL_EXCHANGE',
                                      is_optional=True,
                                      default='internal')

CELERY_RESULT_BACKEND = config.get_redis_url(
    'POLYAXON_REDIS_CELERY_RESULT_BACKEND_URL')

CELERY_WORKER_PREFETCH_MULTIPLIER = config.get_int(
Example #15
0
import json

from rhea import RheaError
from rhea.manager import UriSpec

from polyaxon.config_manager import config

REGISTRY_USER = config.get_string('POLYAXON_REGISTRY_USER', is_optional=True)
REGISTRY_PASSWORD = config.get_string('POLYAXON_REGISTRY_PASSWORD', is_optional=True)
REGISTRY_PORT = config.get_string('POLYAXON_REGISTRY_PORT', is_optional=True)
REGISTRY_NODE_PORT = config.get_string('POLYAXON_REGISTRY_NODE_PORT', is_optional=True)
REGISTRY_HOST = config.get_string('POLYAXON_REGISTRY_HOST', is_optional=True)
REGISTRY_IN_CLUSTER = config.get_boolean('POLYAXON_REGISTRY_IN_CLUSTER',
                                         is_optional=True,
                                         default=True)
REGISTRY_LOCAL_URI = '{}:{}'.format('127.0.0.1', REGISTRY_NODE_PORT)

REGISTRY_URI = None
if REGISTRY_HOST:
    if REGISTRY_PORT:
        REGISTRY_URI = '{}:{}'.format(REGISTRY_HOST, REGISTRY_PORT)
    else:
        REGISTRY_URI = REGISTRY_HOST
if not REGISTRY_URI:
    REGISTRY_URI = REGISTRY_LOCAL_URI
PRIVATE_REGISTRIES_PREFIX = 'POLYAXON_PRIVATE_REGISTRY_'


def get_external_registries():
    registries = []
    for key in config.keys_startswith(PRIVATE_REGISTRIES_PREFIX):
Example #16
0
from polyaxon.config_manager import config

DEFAULT_FROM_EMAIL = config.get_string('POLYAXON_EMAIL_FROM',
                                       is_optional=True,
                                       default='<Polyaxon>')
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',
                                         is_optional=True,
                                         default='[Polyaxon]')
EMAIL_USE_TLS = config.get_boolean('POLYAXON_EMAIL_USE_TLS',
                                   is_optional=True,
                                   default=False)

if config.is_debug_mode or config.is_testing_env:
    EMAIL_BACKEND = config.get_string(
        'POLYAXON_EMAIL_BACKEND',
        is_optional=True,
        default='django.core.mail.backends.console.EmailBackend')