def Run(self, args):
        """Describe a job."""
        client = jobs.JobsClient(self.ReleaseTrack())

        job_ref = args.CONCEPTS.job_name.Parse()

        return client.Get(job_ref)
Example #2
0
    def Run(self, args):
        """List jobs."""
        client = jobs.JobsClient()

        parent_ref = args.CONCEPTS.location.Parse()

        return client.List(parent_ref, page_size=args.page_size)
Example #3
0
  def Run(self, args):
    """Delete a job."""
    client = jobs.JobsClient(self.ReleaseTrack())

    job_ref = args.CONCEPTS.job_name.Parse()

    console_io.PromptContinue(
        'You are about to delete job [{}]'.format(job_ref.jobsId),
        throw_if_unattended=True, cancel_on_no=True)

    result = client.Delete(job_ref)
    log.DeletedResource(job_ref.RelativeName(), kind='job')
    return result
Example #4
0
    def Run(self, args):
        """Create a job."""
        util.ValidateCreateJobArguments(args)

        client = jobs.JobsClient()

        parent_ref = args.CONCEPTS.location.Parse()
        input_uri = args.input_uri
        output_uri = args.output_uri
        priority = args.priority

        template_id = args.template_id
        job_config = None
        if template_id is None:
            job_config = util.GetContent(args.file, args.json)

        return client.Create(parent_ref=parent_ref,
                             job_json=job_config,
                             template_id=template_id,
                             input_uri=input_uri,
                             output_uri=output_uri,
                             priority=priority)