Пример #1
0
 def get_spark_config(self, paasta_args=None):
     paasta_args = paasta_args or {}
     args = mock.MagicMock()
     for k, v in paasta_args.items():
         setattr(args, k, v)
     if "cluster" not in paasta_args:
         args.cluster = "fake_cluster"
     return get_spark_config(
         args=args,
         spark_app_name="fake_name",
         spark_ui_port=123,
         docker_img="fake-registry/fake-service",
         system_paasta_config=SystemPaastaConfig(
             {"cluster_fqdn_format": "paasta-{cluster:s}.something"},
             "fake_dir"),
         volumes=["v1:v1:rw", "v2:v2:rw"],
         access_key="test_access_key",
         secret_key="test_secret_key",
     )
Пример #2
0
def test_get_spark_config(
    mock_find_mesos_leader,
):
    mock_find_mesos_leader.return_value = 'fake_leader'
    args = mock.MagicMock()
    args.cluster = 'fake_cluster'

    spark_conf = get_spark_config(
        args=args,
        container_name='fake_name',
        spark_ui_port=123,
        docker_img='fake-registry/fake-service',
        system_paasta_config=SystemPaastaConfig(
            {"cluster_fqdn_format": "paasta-{cluster:s}.something"},
            'fake_dir',
        ),
        volumes=['v1:v1:rw', 'v2:v2:rw'],
    )

    assert spark_conf['spark.master'] == 'mesos://fake_leader:5050'
    assert 'spark.master=mesos://fake_leader:5050' in create_spark_config_str(spark_conf)