当前位置: 首页>>代码示例>>Python>>正文


Python config.AuroraConfig类代码示例

本文整理汇总了Python中apache.aurora.config.AuroraConfig的典型用法代码示例。如果您正苦于以下问题:Python AuroraConfig类的具体用法?Python AuroraConfig怎么用?Python AuroraConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AuroraConfig类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_config_with_ports

def test_config_with_ports():
    hwc = HELLO_WORLD(
        task=HELLO_WORLD.task()(
            processes=[Process(name="hello_world", cmdline="echo {{thermos.ports[http]}} {{thermos.ports[admin]}}")]
        )
    )
    config = AuroraConfig(hwc)
    job = config.job()
    assert job.taskConfig.requestedPorts == set(["http", "admin"])
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:9,代码来源:test_thrift.py

示例2: test_pick

def test_pick():
  env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG))

  hello_world = env['jobs'][0]
  assert AuroraConfig.pick(env, 'hello_world', None) == hello_world

  env['jobs'][0] = env['jobs'][0](name='something_{{else}}')
  assert str(AuroraConfig.pick(env, 'something_else', [{'else': 'else'}]).name()) == (
      'something_else')
开发者ID:AltanAlpay,项目名称:aurora,代码行数:9,代码来源:test_loader.py

示例3: test_pick

def test_pick():
  with temporary_file() as fp:
    fp.write(MESOS_CONFIG)
    fp.flush()
    env = AuroraConfigLoader.load(fp.name)

  hello_world = env['jobs'][0]
  assert AuroraConfig.pick(env, 'hello_world', None) == hello_world

  env['jobs'][0] = env['jobs'][0](name='something_{{else}}')
  assert str(AuroraConfig.pick(env, 'something_else', [{'else': 'else'}]).name()) == (
      'something_else')
开发者ID:KancerEzeroglu,项目名称:aurora,代码行数:12,代码来源:test_loader.py

示例4: test_simple_config

def test_simple_config():
    with temporary_file() as fp:
        fp.write(MESOS_CONFIG)
        fp.flush()
        proxy_config1 = AuroraConfig.load(fp.name)
        proxy_config2 = AuroraConfig.load(fp.name, name="hello_world")
        assert proxy_config1.job()
        assert proxy_config1._job == proxy_config2._job
        assert proxy_config1._job == REIFIED_CONFIG
        assert proxy_config1.name() == "hello_world"
        assert proxy_config1.role() == "john_doe"
        assert proxy_config1.cluster() == "smf1-test"
        assert proxy_config1.ports() == set()
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:13,代码来源:test_base.py

示例5: test_config_with_ports

def test_config_with_ports():
  hwc = HELLO_WORLD(
    task=HELLO_WORLD.task()(
      processes=[
        Process(name='hello_world',
                cmdline='echo {{thermos.ports[http]}} {{thermos.ports[admin]}}')
      ]
    )
  )
  config = AuroraConfig(hwc)
  job = config.job()
  assert Resource(namedPort='http') in list(job.taskConfig.resources)
  assert Resource(namedPort='admin') in list(job.taskConfig.resources)
开发者ID:apache,项目名称:aurora,代码行数:13,代码来源:test_thrift.py

示例6: test_inject_default_environment

def test_inject_default_environment():
  base_job = Job(
      name='hello_world', role='john_doe', cluster='smf1-test',
      task=Task(name='main', processes=[],
                resources=Resources(cpu=0.1, ram=64 * MB, disk=64 * MB)))

  no_env_config = AuroraConfig(base_job)
  config._inject_default_environment(no_env_config)
  assert no_env_config.environment() == DEFAULT_ENVIRONMENT

  test_env_config = AuroraConfig(base_job(environment='test'))
  config._inject_default_environment(test_env_config)
  assert test_env_config.environment() == 'test'
开发者ID:betepahos,项目名称:incubator-aurora,代码行数:13,代码来源:test_config.py

示例7: test_config_with_task_links

def test_config_with_task_links():
    tl = Map(String, String)
    unresolved_tl = {
        "foo": "http://%host%:{{thermos.ports[foo]}}",
        "bar": "http://%host%:{{thermos.ports[bar]}}/{{mesos.instance}}",
    }
    resolved_tl = {"foo": "http://%host%:%port:foo%", "bar": "http://%host%:%port:bar%/%shard_id%"}
    aurora_config = AuroraConfig(HELLO_WORLD(task_links=tl(unresolved_tl)))
    assert aurora_config.task_links() == tl(resolved_tl)
    assert aurora_config.job().taskConfig.taskLinks == frozendict(resolved_tl)

    bad_tl = {"foo": "{{thermos.ports.bad}}"}
    with pytest.raises(AuroraConfig.InvalidConfig):
        AuroraConfig(HELLO_WORLD(task_links=tl(bad_tl))).job()
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:14,代码来源:test_thrift.py

示例8: test_inject_default_environment

def test_inject_default_environment():
    base_job = Job(
        name="hello_world",
        role="john_doe",
        cluster="test-cluster",
        task=Task(name="main", processes=[], resources=Resources(cpu=0.1, ram=64 * MB, disk=64 * MB)),
    )

    no_env_config = AuroraConfig(base_job)
    config._inject_default_environment(no_env_config)
    assert no_env_config.environment() == DEFAULT_ENVIRONMENT

    test_env_config = AuroraConfig(base_job(environment="test"))
    config._inject_default_environment(test_env_config)
    assert test_env_config.environment() == "test"
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:15,代码来源:test_config.py

示例9: _start_release

  def _start_release(self, api, context):
    package, config_content = get_config(
        context.options.jobspec, context.options.version or 'latest')

    config = AuroraConfig.loads_json(config_content)
    resp = api.start_job_update(config, message='Release started by %s.' % getpass.getuser())

    if not resp.result:
      return package, None

    return package, resp.result.startJobUpdateResult.key.id
开发者ID:pombredanne,项目名称:sacker,代码行数:11,代码来源:deploy_noun.py

示例10: test_docker_binding_throws

  def test_docker_binding_throws(self, mock_resolve):
    mock_resolve.side_effect = Exception('mock resolve failure')

    binding_helper.unregister_all()
    BindingHelper.register(DockerBindingHelper())

    with temporary_file() as fp:
      fp.write(DOCKER_BINDING_CONFIG)
      fp.flush()
      with CLUSTERS.patch(TEST_CLUSTERS):
        cfg = AuroraConfig.load(fp.name)
        with pytest.raises(Exception):
          binding_helper.apply_all(cfg)
          assert mock_resolve.mock_calls == [call(TEST_CLUSTER, 'some/name', 'some.tag')]
开发者ID:apache,项目名称:aurora,代码行数:14,代码来源:test_docker_helper.py

示例11: test_docker_binding

  def test_docker_binding(self, mock_resolve):
    image_reference = 'registry.example.com/some/[email protected]:digest'

    mock_resolve.return_value = image_reference

    binding_helper.unregister_all()
    BindingHelper.register(DockerBindingHelper())

    with temporary_file() as fp:
      fp.write(DOCKER_BINDING_CONFIG)
      fp.flush()
      with CLUSTERS.patch(TEST_CLUSTERS):
        cfg = AuroraConfig.load(fp.name)
        binding_helper.apply_all(cfg)
        assert cfg.job().taskConfig.container.docker.image == image_reference
        assert mock_resolve.mock_calls == [call(TEST_CLUSTER, 'some/name', 'some.tag')]
开发者ID:apache,项目名称:aurora,代码行数:16,代码来源:test_docker_helper.py

示例12: _job_diff

 def _job_diff(self, api, context, config_content):
   # return true if jobs are diff, false if not
   config = AuroraConfig.loads_json(config_content)
   role, env, name = config.role(), config.environment(), config.name()
   resp = api.query(api.build_query(role, name, env=env, statuses=ACTIVE_STATES))
   context.log_response_and_raise(resp, err_code=EXIT_INVALID_PARAMETER,
       err_msg="Could not find job to diff against")
   if resp.result.scheduleStatusResult.tasks is None:
     context.print_err("No tasks found for job %s" % context.options.jobspec)
     return True
   else:
     remote_tasks = [t.assignedTask.task for t in resp.result.scheduleStatusResult.tasks]
   resp = api.populate_job_config(config)
   context.log_response_and_raise(resp, err_code=EXIT_INVALID_CONFIGURATION,
         err_msg="Error loading configuration")
   local_tasks = [resp.result.populateJobResult.taskConfig] * config.instances()
   if len(remote_tasks) != len(local_tasks):
     return True
   for task1, task2 in zip(remote_tasks, local_tasks):
     if task1 != task2:
       return True
   return False
开发者ID:pombredanne,项目名称:sacker,代码行数:22,代码来源:deploy_noun.py

示例13: test_empty_config

def test_empty_config():
    with pytest.raises(AuroraConfig.InvalidConfig):
        with temporary_file() as fp:
            fp.write(UNDERSPECIFIED_MESOS_CONFIG)
            fp.flush()
            AuroraConfig.load(fp.name)
开发者ID:kevinburg,项目名称:incubator-aurora,代码行数:6,代码来源:test_base.py

示例14: write_and_load_config

def write_and_load_config(role):
  with temporary_file() as fp:
    fp.write(GENERIC_CONFIG)
    fp.flush()
    return AuroraConfig.load(fp.name, name='hello_world', select_role=role)
开发者ID:MustafaOrkunAcar,项目名称:incubator-aurora,代码行数:5,代码来源:test_binding_helper.py


注:本文中的apache.aurora.config.AuroraConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。