Beispiel #1
0
def create_dump(ctx):
    manifest_log = StringIO()
    manifest_handler = logging.StreamHandler(manifest_log)
    setup_loghandler(manifest_handler, ctx.options["verbose"])
    log.addHandler(manifest_handler)

    scopes = ctx.options["scopes"]

    meta = ctx.manifest["meta"] = OrderedDict()
    meta["invocation_time"] = datetime.now().isoformat()
    meta["finish_time"] = None
    meta["argv"] = sys.argv
    meta["options"] = ctx.options
    meta["host"] = gethostname()
    meta["uid"] = os.getuid()
    meta["gid"] = os.getgid()
    meta["version"] = VERSION

    init_storage(ctx)

    base_dir = str(ctx.options["project_dir"])
    config_path = get_config_path_from_options(
        base_dir, {"--file": ctx.options["compose_files"]}, ctx.environment
    )
    ctx.project = get_project(
        base_dir,
        config_path=config_path,
        project_name=ctx.options["project_name"],
        verbose=ctx.options["verbose"],
        host=None,
        tls_config=None,
        environment=ctx.environment,
    )

    if "config" in scopes:
        store_config(ctx)

    if "mounted" in scopes or "volumes" in scopes:
        if not ctx.options["no_pause"]:
            ctx.project.pause(service_names=ctx.options["services"])
        store_volumes(ctx)
        if not ctx.options["no_pause"]:
            ctx.project.unpause(service_names=ctx.options["services"])

    meta["finish_time"] = datetime.now().isoformat()

    normalize_manifest_mapping(ctx.manifest)
    manifest_log.seek(0)

    doc = yaml.dump(ctx.manifest, default_flow_style=False)
    doc += "---\n"
    doc += yaml.dump(
        [x.strip() for x in manifest_log.readlines() if x], default_style='"'
    )

    ctx.storage.write_file(doc, "Manifest.yml")

    ctx.storage.finalize()
Beispiel #2
0
 def _createWidget(self):
     guess = gethostname().lower()
     beamline = '#default#'
     for hostname in ['dragon']:
         if guess.startswith(hostname):
             beamline = 'ID08'
             break
     _logger.debug('_createWidget -- beamline = "%s"', beamline)
     parent = None
     self.widget = XMCDWindow.XMCDWidget(parent,
                                           self._plotWindow,
                                           beamline,
                                           nSelectors = 5)
 def _createWidget(self):
     guess = gethostname().lower()
     if guess.startswith('dragon'):
         beamline = 'ID08'
     else:
         beamline = '#default#'
     if DEBUG:
         print '_createWidget -- beamline = "%s"' % beamline
     parent = None
     self.widget = SortPlotsWindow.SortPlotsWidget(parent,
                                                   self._plotWindow,
                                                   beamline,
                                                   nSelectors=2)
Beispiel #4
0
 def _createWidget(self):
     guess = gethostname().lower()
     beamline = '#default#'
     for hostname in ['dragon']:
         if guess.startswith(hostname):
             beamline = 'ID08'
             break
     _logger.debug('_createWidget -- beamline = "%s"', beamline)
     parent = None
     self.widget = XMCDWindow.XMCDWidget(parent,
                                           self._plotWindow,
                                           beamline,
                                           nSelectors = 5)
Beispiel #5
0
def create_dump(ctx):
    manifest_log = StringIO()
    manifest_handler = logging.StreamHandler(manifest_log)
    setup_loghandler(manifest_handler, ctx.options['verbose'])
    log.addHandler(manifest_handler)

    scopes = ctx.options['scopes']

    meta = ctx.manifest['meta'] = OrderedDict()
    meta['invocation_time'] = datetime.now().isoformat()
    meta['finish_time'] = None
    meta['argv'] = sys.argv
    meta['options'] = ctx.options
    meta['host'] = gethostname()
    meta['uid'] = os.getuid()
    meta['gid'] = os.getgid()
    meta['version'] = VERSION

    init_storage(ctx)

    base_dir = str(ctx.options['project_dir'])
    config_path = get_config_path_from_options(
        base_dir, {'--file': ctx.options['compose_files']}, ctx.environment)
    ctx.project = \
        get_project(base_dir, config_path=config_path,
                    project_name=ctx.options['project_name'],
                    verbose=ctx.options['verbose'], host=None, tls_config=None, environment=ctx.environment)

    if 'config' in scopes:
        store_config(ctx)

    if 'mounted' in scopes or 'volumes' in scopes:
        if not ctx.options['no_pause']:
            ctx.project.pause(service_names=ctx.options['services'])
        store_volumes(ctx)
        if not ctx.options['no_pause']:
            ctx.project.unpause(service_names=ctx.options['services'])

    meta['finish_time'] = datetime.now().isoformat()

    normalize_manifest_mapping(ctx.manifest)
    manifest_log.seek(0)

    doc = yaml.dump(ctx.manifest, default_flow_style=False)
    doc += '---\n'
    doc += yaml.dump([x.strip() for x in manifest_log.readlines() if x],
                     default_style='"')

    ctx.storage.write_file(doc, 'Manifest.yml')

    ctx.storage.finalize()
Beispiel #6
0
def create_dump(ctx):
    manifest_log = StringIO()
    manifest_handler = logging.StreamHandler(manifest_log)
    setup_loghandler(manifest_handler, ctx.options['verbose'])
    log.addHandler(manifest_handler)

    scopes = ctx.options['scopes']

    meta = ctx.manifest['meta'] = OrderedDict()
    meta['invocation_time'] = datetime.now().isoformat()
    meta['finish_time'] = None
    meta['argv'] = sys.argv
    meta['options'] = ctx.options
    meta['host'] = gethostname()
    meta['uid'] = os.getuid()
    meta['gid'] = os.getgid()
    meta['version'] = __version__

    init_storage(ctx)

    base_dir = str(ctx.options['project_dir'])
    config_path = get_config_path_from_options(
        base_dir, {'--file': ctx.options['compose_files']}, ctx.environment)
    ctx.project = \
        get_project(base_dir, config_path=config_path,
                    project_name=ctx.options['project_name'],
                    verbose=ctx.options['verbose'], host=None, tls_config=None, environment=ctx.environment)

    if 'config' in scopes:
        store_config(ctx)

    if 'mounted' in scopes or 'volumes' in scopes:
        if ctx.options['no_pause']:
            ctx.project.pause(service_names=ctx.options['services'])
        store_volumes(ctx)
        if ctx.options['no_pause']:
            ctx.project.unpause(service_names=ctx.options['services'])

    meta['finish_time'] = datetime.now().isoformat()

    normalize_manifest_mapping(ctx.manifest)
    manifest_log.seek(0)

    doc = yaml.dump(ctx.manifest, default_flow_style=False)
    doc += '---\n'
    doc += yaml.dump([x.strip() for x in manifest_log.readlines() if x], default_style='"')

    ctx.storage.write_file(doc, 'Manifest.yml')

    ctx.storage.finalize()
Beispiel #7
0
from platform import node as gethostname
from os import environ

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '%ooho!5!^e(r)*sjjfe0)fi2k6z$ji9xq*d$izk1g4@o5wb+bm'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [gethostname(), gethostname().split('.')[0]]
ALLOWED_HOSTS.extend(('localhost', '127.0.0.1'))
if 'ALLOWED_HOSTS' in environ.keys():
    ALLOWED_HOSTS.extend(environ['ALLOWED_HOSTS'].split(':'))
# Application definition

INSTALLED_APPS = [
    'polls.apps.PollsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]