Exemple #1
0
    def __init__(
        self,
        job_file="test_stateless_job_spec.yaml",
        client=None,
        config=None,
        pool=None,
        job_config=None,
        job_id=None,
    ):

        self.config = config or IntegrationTestConfig(
            pool_file='test_stateless_respool.yaml')
        self.client = client or Client()
        self.pool = pool or Pool(self.config, client=self.client)
        self.job_id = job_id
        self.entity_version = None
        self.job_spec = None

        if job_config is not None:
            self.job_spec = job_config

        if job_id is not None:
            self.job_spec = self.get_spec()

        if self.job_spec is None:
            job_spec_dump = load_test_config(job_file)
            job_spec = stateless.JobSpec()
            json_format.ParseDict(job_spec_dump, job_spec)
            self.job_spec = job_spec
def create_stateless_job_spec(name, labels, instance_count, default_config,
                              respool_id):
    job_spec = stateless.JobSpec(
        name=name,
        labels=labels,
        owning_team="compute",
        description="test job",
        instance_count=instance_count,
        default_spec=default_config,
        respool_id=v1alpha_peloton.ResourcePoolID(value=respool_id),
        sla=stateless.SlaSpec(priority=1, preemptible=False),
    )
    return job_spec
Exemple #3
0
def read_job_spec(filename):
    job_spec_dump = load_test_config(filename)
    job_spec = stateless.JobSpec()
    json_format.ParseDict(job_spec_dump, job_spec)
    return job_spec