def build_dcos_files_from_stubs(
    stub_universe_urls: List, dcos_files_path: str, tmpdir_factory  # _pytest.TempdirFactory
) -> List[Tuple[str, str, str]]:
    if not len(stub_universe_urls):
        return stub_universe_urls
    package_file_paths = []
    for repo_url in stub_universe_urls:
        headers = {
            "User-Agent": "dcos/{}".format(sdk_utils.dcos_version()),
            "Accept": "application/vnd.dcos.universe.repo+json;"
            "charset=utf-8;version={}".format("v4"),
        }
        req = urllib.request.Request(repo_url, headers=headers)
        with urllib.request.urlopen(req) as f:
            data = json.loads(f.read().decode())
            for package in data["packages"]:
                package_file_paths.append(
                    build_dcos_file_from_universe_definition(
                        package, dcos_files_path, tmpdir_factory
                    )
                )
    return package_file_paths
def build_dcos_files_from_stubs(
    stub_universe_urls: List[str], dcos_files_path: str, tmpdir_factory: TempdirFactory,
) -> List[Tuple[str, str, str]]:
    if not len(stub_universe_urls):
        return []
    package_file_paths = []
    for repo_url in stub_universe_urls:
        headers = {
            "User-Agent": "dcos/{}".format(sdk_utils.dcos_version()),
            "Accept": "application/vnd.dcos.universe.repo+json;"
            "charset=utf-8;version={}".format("v4"),
        }
        req = urllib.request.Request(repo_url, headers=headers)
        with urllib.request.urlopen(req) as f:
            data = json.loads(f.read().decode())
            for package in data["packages"]:
                package_file_paths.append(
                    build_dcos_file_from_universe_definition(
                        package, dcos_files_path, tmpdir_factory
                    )
                )
    return package_file_paths
        driver_cpus = available_cpus[0]

        global executor_cpus
        executor_cpus = available_cpus[1]

        log.info(
            f"{driver_cpus} cores will be used for driver, {executor_cpus} cores will be used for executor"
        )
        yield
    finally:
        utils.teardown_spark()


@pytest.mark.sanity
@pytest.mark.skipif(
    '2.1.0' == sdk_utils.dcos_version(),
    reason=
    "Since DC/OS 2.1.0 is unable to stop dcos-mesos-slave, refer this https://jira.d2iq.com/browse/D2IQ-69935"
)
def test_agent_restart_with_checkpointing_disabled():
    (driver_task_id, driver_task, executor_task) = _submit_job_and_get_tasks()

    driver_ip = sdk_networks.get_task_host(driver_task)
    executor_ip = sdk_networks.get_task_host(executor_task)

    # Dispatcher starts Driver Tasks with checkpointing enabled so Driver is expected to be in RUNNING state
    utils.restart_task_agent_and_verify_state(driver_ip, driver_task,
                                              "TASK_RUNNING")
    utils.restart_task_agent_and_verify_state(executor_ip, executor_task,
                                              "TASK_LOST")