Operazioni in gruppo (v4beta1)

Cloud Talent Solution supporta le operazioni batch asincrone, che ti consentono di inserire più chiamate API in una singola richiesta HTTP. Il tipo di risposta restituito è google.longrunning.operation. Lo stato dettagliato dell'operazione batch può essere recuperato chiamando il metodo GetOperation tramite il campo name in google.longrunning.operation.

L'utilizzo del raggruppamento genera una latenza ridotta nei tempi di risposta dell'API e una velocità effettiva superiore. Tieni presente che la ricezione corretta di una risposta dell'API batch indica solo che la richiesta batch è stata creata. L'effettiva elaborazione dei dati avviene in modo asincrono. Le operazioni collettive create più di 30 giorni fa non saranno più accessibili con il metodo GetOperation.

Ogni batch è limitato a 200 richieste.

Indicatore di avanzamento dell'operazione collettiva

L'elemento google.longrunning.operation creato chiamando il metodo di creazione o aggiornamento in batch rientra in uno dei seguenti stati:

  • STATE_UNSPECIFIED (valore predefinito)
  • INIZIALIZZAZIONE
  • IN FASE DI ELABORAZIONE
  • COMPLETATO
  • OPERAZIONE NON RIUSCITA

Nello stato INIZIALIZZAZIONE, i campi success_count, failure_count e total_count sono impostati su 0. Se l'operazione è nello stato PROCESSING, success_count e failure_count potrebbero aumentare. Nello stato SUCCEEDED, success_count + failure_count è sempre uguale a total_count e success_count > 0. Nello stato NON RIUSCITO, success_count è sempre 0.

Creazione in gruppo di job

Il seguente esempio di codice mostra come creare job in batch:

Java

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Java CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.api.gax.longrunning.OperationFuture;
 * import com.google.cloud.talent.v4beta1.BatchCreateJobsRequest;
 * import com.google.cloud.talent.v4beta1.BatchOperationMetadata;
 * import com.google.cloud.talent.v4beta1.Job;
 * import com.google.cloud.talent.v4beta1.Job.ApplicationInfo;
 * import com.google.cloud.talent.v4beta1.JobOperationResult;
 * import com.google.cloud.talent.v4beta1.JobServiceClient;
 * import com.google.cloud.talent.v4beta1.TenantName;
 * import java.util.Arrays;
 * import java.util.List;
 */

public static void sampleBatchCreateJobs() {
  // TODO(developer): Replace these variables before running the sample.
  String projectId = "Your Google Cloud Project ID";
  String tenantId = "Your Tenant ID (using tenancy is optional)";
  String companyNameOne = "Company name, e.g. projects/your-project/companies/company-id";
  String requisitionIdOne = "Job requisition ID, aka Posting ID. Unique per job.";
  String titleOne = "Software Engineer";
  String descriptionOne = "This is a description of this <i>wonderful</i> job!";
  String jobApplicationUrlOne = "https://www.example.org/job-posting/123";
  String addressOne = "1600 Amphitheatre Parkway, Mountain View, CA 94043";
  String languageCodeOne = "en-US";
  String companyNameTwo = "Company name, e.g. projects/your-project/companies/company-id";
  String requisitionIdTwo = "Job requisition ID, aka Posting ID. Unique per job.";
  String titleTwo = "Quality Assurance";
  String descriptionTwo = "This is a description of this <i>wonderful</i> job!";
  String jobApplicationUrlTwo = "https://www.example.org/job-posting/123";
  String addressTwo = "111 8th Avenue, New York, NY 10011";
  String languageCodeTwo = "en-US";
  sampleBatchCreateJobs(
      projectId,
      tenantId,
      companyNameOne,
      requisitionIdOne,
      titleOne,
      descriptionOne,
      jobApplicationUrlOne,
      addressOne,
      languageCodeOne,
      companyNameTwo,
      requisitionIdTwo,
      titleTwo,
      descriptionTwo,
      jobApplicationUrlTwo,
      addressTwo,
      languageCodeTwo);
}

/**
 * Batch Create Jobs
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleBatchCreateJobs(
    String projectId,
    String tenantId,
    String companyNameOne,
    String requisitionIdOne,
    String titleOne,
    String descriptionOne,
    String jobApplicationUrlOne,
    String addressOne,
    String languageCodeOne,
    String companyNameTwo,
    String requisitionIdTwo,
    String titleTwo,
    String descriptionTwo,
    String jobApplicationUrlTwo,
    String addressTwo,
    String languageCodeTwo) {
  try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
    String formattedParent = TenantName.format(projectId, tenantId);
    List<String> uris = Arrays.asList(jobApplicationUrlOne);
    Job.ApplicationInfo applicationInfo =
        Job.ApplicationInfo.newBuilder().addAllUris(uris).build();
    List<String> addresses = Arrays.asList(addressOne);
    Job jobsElement =
        Job.newBuilder()
            .setCompany(companyNameOne)
            .setRequisitionId(requisitionIdOne)
            .setTitle(titleOne)
            .setDescription(descriptionOne)
            .setApplicationInfo(applicationInfo)
            .addAllAddresses(addresses)
            .setLanguageCode(languageCodeOne)
            .build();
    List<String> uris2 = Arrays.asList(jobApplicationUrlTwo);
    Job.ApplicationInfo applicationInfo2 =
        Job.ApplicationInfo.newBuilder().addAllUris(uris2).build();
    List<String> addresses2 = Arrays.asList(addressTwo);
    Job jobsElement2 =
        Job.newBuilder()
            .setCompany(companyNameTwo)
            .setRequisitionId(requisitionIdTwo)
            .setTitle(titleTwo)
            .setDescription(descriptionTwo)
            .setApplicationInfo(applicationInfo2)
            .addAllAddresses(addresses2)
            .setLanguageCode(languageCodeTwo)
            .build();
    List<Job> jobs = Arrays.asList(jobsElement, jobsElement2);
    BatchCreateJobsRequest request =
        BatchCreateJobsRequest.newBuilder().setParent(formattedParent).addAllJobs(jobs).build();
    OperationFuture<JobOperationResult, BatchOperationMetadata> future =
        jobServiceClient.batchCreateJobsAsync(request);

    System.out.println("Waiting for operation to complete...");
    JobOperationResult response = future.get();
    System.out.printf("Batch response: %s\n", response);
  } catch (Exception exception) {
    System.err.println("Failed to create the client due to: " + exception);
  }
}

Node.js

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Node.js CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.


const talent = require('@google-cloud/talent').v4beta1;

/**
 * Batch Create Jobs
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
async function sampleBatchCreateJobs(projectId, tenantId, companyNameOne, requisitionIdOne, titleOne, descriptionOne, jobApplicationUrlOne, addressOne, languageCodeOne, companyNameTwo, requisitionIdTwo, titleTwo, descriptionTwo, jobApplicationUrlTwo, addressTwo, languageCodeTwo) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyNameOne = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionIdOne = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const titleOne = 'Software Engineer';
  // const descriptionOne = 'This is a description of this <i>wonderful</i> job!';
  // const jobApplicationUrlOne = 'https://www.example.org/job-posting/123';
  // const addressOne = '1600 Amphitheatre Parkway, Mountain View, CA 94043';
  // const languageCodeOne = 'en-US';
  // const companyNameTwo = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionIdTwo = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const titleTwo = 'Quality Assurance';
  // const descriptionTwo = 'This is a description of this <i>wonderful</i> job!';
  // const jobApplicationUrlTwo = 'https://www.example.org/job-posting/123';
  // const addressTwo = '111 8th Avenue, New York, NY 10011';
  // const languageCodeTwo = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const uris = [jobApplicationUrlOne];
  const applicationInfo = {
    uris: uris,
  };
  const addresses = [addressOne];
  const jobsElement = {
    company: companyNameOne,
    requisitionId: requisitionIdOne,
    title: titleOne,
    description: descriptionOne,
    applicationInfo: applicationInfo,
    addresses: addresses,
    languageCode: languageCodeOne,
  };
  const uris2 = [jobApplicationUrlTwo];
  const applicationInfo2 = {
    uris: uris2,
  };
  const addresses2 = [addressTwo];
  const jobsElement2 = {
    company: companyNameTwo,
    requisitionId: requisitionIdTwo,
    title: titleTwo,
    description: descriptionTwo,
    applicationInfo: applicationInfo2,
    addresses: addresses2,
    languageCode: languageCodeTwo,
  };
  const jobs = [jobsElement, jobsElement2];
  const request = {
    parent: formattedParent,
    jobs: jobs,
  };

  // Create a job whose results you can either wait for now, or get later
  const [operation] = await client.batchCreateJobs(request);

  // Get a Promise representation of the final result of the job
  const [response] = await operation.promise();

  console.log(`Batch response: ${response}`);
}

Python

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Python CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.


from google.cloud import talent
import six

def batch_create_jobs(
    project_id,
    tenant_id,
    company_name_one,
    requisition_id_one,
    title_one,
    description_one,
    job_application_url_one,
    address_one,
    language_code_one,
    company_name_two,
    requisition_id_two,
    title_two,
    description_two,
    job_application_url_two,
    address_two,
    language_code_two,
):
    """
    Batch Create Jobs

    Args:
      project_id Your Google Cloud Project ID
      tenant_id Identifier of the Tenant
    """

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_name_one = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id_one = 'Job requisition ID, aka Posting ID. Unique per job.'
    # title_one = 'Software Engineer'
    # description_one = 'This is a description of this <i>wonderful</i> job!'
    # job_application_url_one = 'https://www.example.org/job-posting/123'
    # address_one = '1600 Amphitheatre Parkway, Mountain View, CA 94043'
    # language_code_one = 'en-US'
    # company_name_two = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id_two = 'Job requisition ID, aka Posting ID. Unique per job.'
    # title_two = 'Quality Assurance'
    # description_two = 'This is a description of this <i>wonderful</i> job!'
    # job_application_url_two = 'https://www.example.org/job-posting/123'
    # address_two = '111 8th Avenue, New York, NY 10011'
    # language_code_two = 'en-US'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(company_name_one, six.binary_type):
        company_name_one = company_name_one.decode("utf-8")
    if isinstance(requisition_id_one, six.binary_type):
        requisition_id_one = requisition_id_one.decode("utf-8")
    if isinstance(title_one, six.binary_type):
        title_one = title_one.decode("utf-8")
    if isinstance(description_one, six.binary_type):
        description_one = description_one.decode("utf-8")
    if isinstance(job_application_url_one, six.binary_type):
        job_application_url_one = job_application_url_one.decode("utf-8")
    if isinstance(address_one, six.binary_type):
        address_one = address_one.decode("utf-8")
    if isinstance(language_code_one, six.binary_type):
        language_code_one = language_code_one.decode("utf-8")
    if isinstance(company_name_two, six.binary_type):
        company_name_two = company_name_two.decode("utf-8")
    if isinstance(requisition_id_two, six.binary_type):
        requisition_id_two = requisition_id_two.decode("utf-8")
    if isinstance(title_two, six.binary_type):
        title_two = title_two.decode("utf-8")
    if isinstance(description_two, six.binary_type):
        description_two = description_two.decode("utf-8")
    if isinstance(job_application_url_two, six.binary_type):
        job_application_url_two = job_application_url_two.decode("utf-8")
    if isinstance(address_two, six.binary_type):
        address_two = address_two.decode("utf-8")
    if isinstance(language_code_two, six.binary_type):
        language_code_two = language_code_two.decode("utf-8")
    parent = client.tenant_path(project_id, tenant_id)
    uris = [job_application_url_one]
    application_info = {"uris": uris}
    addresses = [address_one]
    jobs_element = {
        "company": company_name_one,
        "requisition_id": requisition_id_one,
        "title": title_one,
        "description": description_one,
        "application_info": application_info,
        "addresses": addresses,
        "language_code": language_code_one,
    }
    uris_2 = [job_application_url_two]
    application_info_2 = {"uris": uris_2}
    addresses_2 = [address_two]
    jobs_element_2 = {
        "company": company_name_two,
        "requisition_id": requisition_id_two,
        "title": title_two,
        "description": description_two,
        "application_info": application_info_2,
        "addresses": addresses_2,
        "language_code": language_code_two,
    }
    jobs = [jobs_element, jobs_element_2]

    operation = client.batch_create_jobs(parent, jobs)

    print("Waiting for operation to complete...")
    response = operation.result(90)

    print("Batch response: {}".format(response))

Aggiornamento batch job

Il seguente esempio di codice mostra come aggiornare in batch i job:

Java

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Java CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.api.gax.longrunning.OperationFuture;
 * import com.google.cloud.talent.v4beta1.BatchOperationMetadata;
 * import com.google.cloud.talent.v4beta1.BatchUpdateJobsRequest;
 * import com.google.cloud.talent.v4beta1.Job;
 * import com.google.cloud.talent.v4beta1.Job.ApplicationInfo;
 * import com.google.cloud.talent.v4beta1.JobOperationResult;
 * import com.google.cloud.talent.v4beta1.JobServiceClient;
 * import com.google.cloud.talent.v4beta1.TenantName;
 * import java.util.Arrays;
 * import java.util.List;
 */

public static void sampleBatchUpdateJobs() {
  // TODO(developer): Replace these variables before running the sample.
  String projectId = "Your Google Cloud Project ID";
  String tenantId = "Your Tenant ID (using tenancy is optional)";
  String jobNameOne = "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id";
  String companyNameOne = "Company name, e.g. projects/your-project/companies/company-id";
  String requisitionIdOne = "Job requisition ID, aka Posting ID. Unique per job.";
  String titleOne = "Software Engineer";
  String descriptionOne = "This is a description of this <i>wonderful</i> job!";
  String jobApplicationUrlOne = "https://www.example.org/job-posting/123";
  String addressOne = "1600 Amphitheatre Parkway, Mountain View, CA 94043";
  String languageCodeOne = "en-US";
  String jobNameTwo = "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id";
  String companyNameTwo = "Company name, e.g. projects/your-project/companies/company-id";
  String requisitionIdTwo = "Job requisition ID, aka Posting ID. Unique per job.";
  String titleTwo = "Quality Assurance";
  String descriptionTwo = "This is a description of this <i>wonderful</i> job!";
  String jobApplicationUrlTwo = "https://www.example.org/job-posting/123";
  String addressTwo = "111 8th Avenue, New York, NY 10011";
  String languageCodeTwo = "en-US";
  sampleBatchUpdateJobs(
      projectId,
      tenantId,
      jobNameOne,
      companyNameOne,
      requisitionIdOne,
      titleOne,
      descriptionOne,
      jobApplicationUrlOne,
      addressOne,
      languageCodeOne,
      jobNameTwo,
      companyNameTwo,
      requisitionIdTwo,
      titleTwo,
      descriptionTwo,
      jobApplicationUrlTwo,
      addressTwo,
      languageCodeTwo);
}

/**
 * Batch Update Jobs
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleBatchUpdateJobs(
    String projectId,
    String tenantId,
    String jobNameOne,
    String companyNameOne,
    String requisitionIdOne,
    String titleOne,
    String descriptionOne,
    String jobApplicationUrlOne,
    String addressOne,
    String languageCodeOne,
    String jobNameTwo,
    String companyNameTwo,
    String requisitionIdTwo,
    String titleTwo,
    String descriptionTwo,
    String jobApplicationUrlTwo,
    String addressTwo,
    String languageCodeTwo) {
  try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
    String formattedParent = TenantName.format(projectId, tenantId);
    List<String> uris = Arrays.asList(jobApplicationUrlOne);
    Job.ApplicationInfo applicationInfo =
        Job.ApplicationInfo.newBuilder().addAllUris(uris).build();
    List<String> addresses = Arrays.asList(addressOne);
    Job jobsElement =
        Job.newBuilder()
            .setName(jobNameOne)
            .setCompany(companyNameOne)
            .setRequisitionId(requisitionIdOne)
            .setTitle(titleOne)
            .setDescription(descriptionOne)
            .setApplicationInfo(applicationInfo)
            .addAllAddresses(addresses)
            .setLanguageCode(languageCodeOne)
            .build();
    List<String> uris2 = Arrays.asList(jobApplicationUrlTwo);
    Job.ApplicationInfo applicationInfo2 =
        Job.ApplicationInfo.newBuilder().addAllUris(uris2).build();
    List<String> addresses2 = Arrays.asList(addressTwo);
    Job jobsElement2 =
        Job.newBuilder()
            .setName(jobNameTwo)
            .setCompany(companyNameTwo)
            .setRequisitionId(requisitionIdTwo)
            .setTitle(titleTwo)
            .setDescription(descriptionTwo)
            .setApplicationInfo(applicationInfo2)
            .addAllAddresses(addresses2)
            .setLanguageCode(languageCodeTwo)
            .build();
    List<Job> jobs = Arrays.asList(jobsElement, jobsElement2);
    BatchUpdateJobsRequest request =
        BatchUpdateJobsRequest.newBuilder().setParent(formattedParent).addAllJobs(jobs).build();
    OperationFuture<JobOperationResult, BatchOperationMetadata> future =
        jobServiceClient.batchUpdateJobsAsync(request);

    System.out.println("Waiting for operation to complete...");
    JobOperationResult response = future.get();
    System.out.printf("Batch response: %s\n", response);
  } catch (Exception exception) {
    System.err.println("Failed to create the client due to: " + exception);
  }
}

Node.js

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Node.js CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.


const talent = require('@google-cloud/talent').v4beta1;

/**
 * Batch Update Jobs
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
async function sampleBatchUpdateJobs(projectId, tenantId, jobNameOne, companyNameOne, requisitionIdOne, titleOne, descriptionOne, jobApplicationUrlOne, addressOne, languageCodeOne, jobNameTwo, companyNameTwo, requisitionIdTwo, titleTwo, descriptionTwo, jobApplicationUrlTwo, addressTwo, languageCodeTwo) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const jobNameOne = 'job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id';
  // const companyNameOne = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionIdOne = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const titleOne = 'Software Engineer';
  // const descriptionOne = 'This is a description of this <i>wonderful</i> job!';
  // const jobApplicationUrlOne = 'https://www.example.org/job-posting/123';
  // const addressOne = '1600 Amphitheatre Parkway, Mountain View, CA 94043';
  // const languageCodeOne = 'en-US';
  // const jobNameTwo = 'job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id';
  // const companyNameTwo = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionIdTwo = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const titleTwo = 'Quality Assurance';
  // const descriptionTwo = 'This is a description of this <i>wonderful</i> job!';
  // const jobApplicationUrlTwo = 'https://www.example.org/job-posting/123';
  // const addressTwo = '111 8th Avenue, New York, NY 10011';
  // const languageCodeTwo = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const uris = [jobApplicationUrlOne];
  const applicationInfo = {
    uris: uris,
  };
  const addresses = [addressOne];
  const jobsElement = {
    name: jobNameOne,
    company: companyNameOne,
    requisitionId: requisitionIdOne,
    title: titleOne,
    description: descriptionOne,
    applicationInfo: applicationInfo,
    addresses: addresses,
    languageCode: languageCodeOne,
  };
  const uris2 = [jobApplicationUrlTwo];
  const applicationInfo2 = {
    uris: uris2,
  };
  const addresses2 = [addressTwo];
  const jobsElement2 = {
    name: jobNameTwo,
    company: companyNameTwo,
    requisitionId: requisitionIdTwo,
    title: titleTwo,
    description: descriptionTwo,
    applicationInfo: applicationInfo2,
    addresses: addresses2,
    languageCode: languageCodeTwo,
  };
  const jobs = [jobsElement, jobsElement2];
  const request = {
    parent: formattedParent,
    jobs: jobs,
  };

  // Create a job whose results you can either wait for now, or get later
  const [operation] = await client.batchUpdateJobs(request);

  // Get a Promise representation of the final result of the job
  const [response] = await operation.promise();

  console.log(`Batch response: ${response}`);
}

Python

Per scoprire come installare e utilizzare la libreria client per CTS, consulta la pagina relativa alle librerie client CTS. Per saperne di più, consulta la documentazione di riferimento dell'API Python CTS.

Per autenticarti su CTS, configura Credenziali predefinite dell'applicazione. Per ulteriori informazioni, consulta la pagina Configurare l'autenticazione per un ambiente di sviluppo locale.


from google.cloud import talent
import six

def batch_update_jobs(
    project_id,
    tenant_id,
    job_name_one,
    company_name_one,
    requisition_id_one,
    title_one,
    description_one,
    job_application_url_one,
    address_one,
    language_code_one,
    job_name_two,
    company_name_two,
    requisition_id_two,
    title_two,
    description_two,
    job_application_url_two,
    address_two,
    language_code_two,
):
    """
    Batch Update Jobs

    Args:
      project_id Your Google Cloud Project ID
      tenant_id Identifier of the Tenant
    """

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # job_name_one = 'job name, projects/your-project/tenants/tenant-id/jobs/job-id'
    # company_name_one = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id_one = 'Job requisition ID, aka Posting ID. Unique per job.'
    # title_one = 'Software Engineer'
    # description_one = 'This is a description of this <i>wonderful</i> job!'
    # job_application_url_one = 'https://www.example.org/job-posting/123'
    # address_one = '1600 Amphitheatre Parkway, Mountain View, CA 94043'
    # language_code_one = 'en-US'
    # job_name_two = 'job name, projects/your-project/tenants/tenant-id/jobs/job-id'
    # company_name_two = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id_two = 'Job requisition ID, aka Posting ID. Unique per job.'
    # title_two = 'Quality Assurance'
    # description_two = 'This is a description of this <i>wonderful</i> job!'
    # job_application_url_two = 'https://www.example.org/job-posting/123'
    # address_two = '111 8th Avenue, New York, NY 10011'
    # language_code_two = 'en-US'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(job_name_one, six.binary_type):
        job_name_one = job_name_one.decode("utf-8")
    if isinstance(company_name_one, six.binary_type):
        company_name_one = company_name_one.decode("utf-8")
    if isinstance(requisition_id_one, six.binary_type):
        requisition_id_one = requisition_id_one.decode("utf-8")
    if isinstance(title_one, six.binary_type):
        title_one = title_one.decode("utf-8")
    if isinstance(description_one, six.binary_type):
        description_one = description_one.decode("utf-8")
    if isinstance(job_application_url_one, six.binary_type):
        job_application_url_one = job_application_url_one.decode("utf-8")
    if isinstance(address_one, six.binary_type):
        address_one = address_one.decode("utf-8")
    if isinstance(language_code_one, six.binary_type):
        language_code_one = language_code_one.decode("utf-8")
    if isinstance(job_name_two, six.binary_type):
        job_name_two = job_name_two.decode("utf-8")
    if isinstance(company_name_two, six.binary_type):
        company_name_two = company_name_two.decode("utf-8")
    if isinstance(requisition_id_two, six.binary_type):
        requisition_id_two = requisition_id_two.decode("utf-8")
    if isinstance(title_two, six.binary_type):
        title_two = title_two.decode("utf-8")
    if isinstance(description_two, six.binary_type):
        description_two = description_two.decode("utf-8")
    if isinstance(job_application_url_two, six.binary_type):
        job_application_url_two = job_application_url_two.decode("utf-8")
    if isinstance(address_two, six.binary_type):
        address_two = address_two.decode("utf-8")
    if isinstance(language_code_two, six.binary_type):
        language_code_two = language_code_two.decode("utf-8")
    parent = client.tenant_path(project_id, tenant_id)
    uris = [job_application_url_one]
    application_info = {"uris": uris}
    addresses = [address_one]
    jobs_element = {
        "name": job_name_one,
        "company": company_name_one,
        "requisition_id": requisition_id_one,
        "title": title_one,
        "description": description_one,
        "application_info": application_info,
        "addresses": addresses,
        "language_code": language_code_one,
    }
    uris_2 = [job_application_url_two]
    application_info_2 = {"uris": uris_2}
    addresses_2 = [address_two]
    jobs_element_2 = {
        "name": job_name_two,
        "company": company_name_two,
        "requisition_id": requisition_id_two,
        "title": title_two,
        "description": description_two,
        "application_info": application_info_2,
        "addresses": addresses_2,
        "language_code": language_code_two,
    }
    jobs = [jobs_element, jobs_element_2]

    operation = client.batch_update_jobs(parent, jobs)

    print("Waiting for operation to complete...")
    response = operation.result(90)

    print("Batch response: {}".format(response))