Class JobServiceClient (0.3.0)

JobServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

A service handles job management, including job CRUD, enumeration and search.

Methods

JobServiceClient

JobServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Constructor.

Parameters
NameDescription
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

credentials google.auth.credentials.Credentials

The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

client_config dict

DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

batch_create_jobs

batch_create_jobs(parent, jobs, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Begins executing a batch create jobs operation.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize jobs:

jobs = []

response = client.batch_create_jobs(parent, jobs)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
NameDescription
parent str

Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".

jobs list[Union[dict, Job]]

Required. The jobs to be created. If a dict is provided, it must be of the same form as the protobuf message Job

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

batch_delete_jobs

batch_delete_jobs(parent, filter_, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes a list of Job\ s by filter.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize filter_:

filter_ = ''

client.batch_delete_jobs(parent, filter_)

Parameters
NameDescription
parent str

Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".

filter_ str

Required. The filter string specifies the jobs to be deleted. Supported operator: =, AND The fields eligible for filtering are: - companyName (Required) - requisitionId (Required) Sample Query: companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1"

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

batch_update_jobs

batch_update_jobs(parent, jobs, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Begins executing a batch update jobs operation.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize jobs:

jobs = []

response = client.batch_update_jobs(parent, jobs)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
NameDescription
parent str

Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".

jobs list[Union[dict, Job]]

Required. The jobs to be updated. If a dict is provided, it must be of the same form as the protobuf message Job

update_mask Union[dict, FieldMask]

Optional but strongly recommended to be provided for the best service experience, also increase latency when checking status of batch operation. If update_mask is provided, only the specified fields in Job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. If update_mask is provided, The Job inside JobResult will only contains fields that is updated, plus the Id of the Job. Otherwise, Job will include all fields, which can yield a very large response. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

company_path

company_path(project, tenant, company)

Return a fully-qualified company string.

company_without_tenant_path

company_without_tenant_path(project, company)

Return a fully-qualified company_without_tenant string.

create_job

create_job(parent, job, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Creates a new job.

Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize job:

job = {}

response = client.create_job(parent, job)

Parameters
NameDescription
parent str

Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and a default tenant is created if unspecified, for example, "projects/api-test-project".

job Union[dict, Job]

Required. The Job to be created. If a dict is provided, it must be of the same form as the protobuf message Job

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

delete_job

delete_job(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes the specified job.

Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

name = client.job_path('[PROJECT]', '[TENANT]', '[JOBS]')

client.delete_job(name)

Parameters
NameDescription
name str

Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

from_service_account_file

from_service_account_file(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
JobServiceClientThe constructed client.

from_service_account_json

from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
JobServiceClientThe constructed client.

get_job

get_job(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

name = client.job_path('[PROJECT]', '[TENANT]', '[JOBS]')

response = client.get_job(name)

Parameters
NameDescription
name str

Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/api-test-project/tenants/foo/jobs/1234". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project/jobs/1234".

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

job_path

job_path(project, tenant, jobs)

Return a fully-qualified job string.

job_without_tenant_path

job_without_tenant_path(project, jobs)

Return a fully-qualified job_without_tenant string.

list_jobs

list_jobs(parent, filter_, page_size=None, job_view=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Lists jobs by filter.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize filter_:

filter_ = ''

Iterate over all results

for element in client.list_jobs(parent, filter_): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_jobs(parent, filter_).pages: ... for element in page: ... # process element ... pass

Parameters
NameDescription
parent str

Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".

filter_ str

Required. The filter string specifies the jobs to be enumerated. Supported operator: =, AND The fields eligible for filtering are: - companyName (Required) - requisitionId (Optional) - status (Optional) Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified. Sample Query: - companyName = "projects/api-test-project/tenants/foo/companies/bar" - companyName = "projects/api-test-project/tenants/foo/companies/bar" AND requisitionId = "req-1" - companyName = "projects/api-test-project/tenants/foo/companies/bar" AND status = "EXPIRED"

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

job_view JobView

Optional. The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_FULL if no value is specified.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

project_path

project_path(project)

Return a fully-qualified project string.

search_jobs

search_jobs(parent, request_metadata, search_mode=None, job_query=None, enable_broadening=None, require_precise_result_size=None, histogram_queries=None, job_view=None, offset=None, page_size=None, order_by=None, diversification_level=None, custom_ranking_info=None, disable_keyword_match=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Searches for jobs using the provided SearchJobsRequest.

This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize request_metadata:

request_metadata = {}

Iterate over all results

for element in client.search_jobs(parent, request_metadata): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.search_jobs(parent, request_metadata).pages: ... for element in page: ... # process element ... pass

Parameters
NameDescription
parent str

Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".

request_metadata Union[dict, RequestMetadata]

Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent. If a dict is provided, it must be of the same form as the protobuf message RequestMetadata

search_mode SearchMode

Optional. Mode of a search. Defaults to SearchMode.JOB_SEARCH.

job_query Union[dict, JobQuery]

Optional. Query used to search against jobs, such as keyword, location filters, etc. If a dict is provided, it must be of the same form as the protobuf message JobQuery

enable_broadening bool

Optional. Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list. Defaults to false.

require_precise_result_size bool

Optional. Controls if the search job request requires the return of a precise count of the first 300 results. Setting this to true ensures consistency in the number of results per page. Best practice is to set this value to true if a client allows users to jump directly to a non-sequential search results page. Enabling this flag may adversely impact performance. Defaults to false.

histogram_queries list[Union[dict, HistogramQuery]]

Optional. An expression specifies a histogram request against matching jobs. Expression syntax is an aggregation function call with histogram facets and other options. Available aggregation function calls are: - count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value. - count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket. Data types: - Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. - String: string like "any string with backslash escape for quote(")." - Number: whole number and floating point number like 10, -1 and -0.01. - List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"]. Built-in constants: - MIN (minimum number similar to java Double.MIN_VALUE) - MAX (maximum number similar to java Double.MAX_VALUE) Built-in functions: - bucket(start, end[, label]): bucket built-in function creates a bucket with range of <code>start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10). Job histogram facets: - company_display_name: histogram by [Job.company_display_name</code>. - employment_type: histogram by Job.employment_types, for example, "FULL_TIME", "PART_TIME". - company_size: histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG". - publish_time_in_month: histogram by the Job.posting_publish_time in months. Must specify list of numeric buckets in spec. - publish_time_in_year: histogram by the Job.posting_publish_time in years. Must specify list of numeric buckets in spec. - degree_types: histogram by the Job.degree_types, for example, "Bachelors", "Masters". - job_level: histogram by the Job.job_level, for example, "Entry Level". - country: histogram by the country code of jobs, for example, "US", "FR". - admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL". - city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY". - admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US". - city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically. - locale: histogram by the Job.language_code, for example, "en-US", "fr-FR". - language: histogram by the language subtag of the Job.language_code, for example, "en", "fr". - category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE". - base_compensation_unit: histogram by the CompensationInfo.CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY". - base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by. - annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by. - annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by. - string_custom_attribute: histogram by string Job.custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"]. - numeric_custom_attribute: histogram by numeric Job.custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by. Example expressions: - count(admin1) - count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)]) - count(string_custom_attribute["some-string-custom-attribute"]) - count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"]) If a dict is provided, it must be of the same form as the protobuf message HistogramQuery

job_view JobView

Optional. The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_SMALL if no value is specified.

offset int

Optional. An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset. For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page).

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

order_by str

Optional. The criteria determining how search results are sorted. Default is "relevance desc". Supported options are: - "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering. - "posting_publish_time desc": By Job.posting_publish_time descending. - "posting_update_time desc": By Job.posting_update_time descending. - "title": By Job.title ascending. - "title desc": By Job.title descending. - "annualized_base_compensation": By job's CompensationInfo.annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_base_compensation desc": By job's CompensationInfo.annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_total_compensation": By job's CompensationInfo.annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_total_compensation desc": By job's CompensationInfo.annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest.CustomRankingInfo.ranking_expression with weight factor assigned by SearchJobsRequest.CustomRankingInfo.importance_level in descending order. - Location sorting: Use the special syntax to order jobs by distance: "distance_from('Hawaii')": Order by distance from Hawaii. "distance_from(19.89, 155.5)": Order by distance from a coordinate. "distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below. "distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below. The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.

diversification_level DiversificationLevel

Optional. Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results. Defaults to DiversificationLevel.SIMPLE if no value is specified.

custom_ranking_info Union[dict, CustomRankingInfo]

Optional. Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). If a dict is provided, it must be of the same form as the protobuf message CustomRankingInfo

disable_keyword_match bool

Optional. Controls whether to disable exact keyword match on Job.title, Job.description, Job.company_display_name, Job.addresses, Job.qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Use Company.keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

search_jobs_for_alert

search_jobs_for_alert(parent, request_metadata, search_mode=None, job_query=None, enable_broadening=None, require_precise_result_size=None, histogram_queries=None, job_view=None, offset=None, page_size=None, order_by=None, diversification_level=None, custom_ranking_info=None, disable_keyword_match=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Searches for jobs using the provided SearchJobsRequest.

This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), and has different algorithmic adjustments that are targeted to passive job seekers.

This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

parent = client.tenant_path('[PROJECT]', '[TENANT]')

TODO: Initialize request_metadata:

request_metadata = {}

Iterate over all results

for element in client.search_jobs_for_alert(parent, request_metadata): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.search_jobs_for_alert(parent, request_metadata).pages: ... for element in page: ... # process element ... pass

Parameters
NameDescription
parent str

Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project".

request_metadata Union[dict, RequestMetadata]

Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent. If a dict is provided, it must be of the same form as the protobuf message RequestMetadata

search_mode SearchMode

Optional. Mode of a search. Defaults to SearchMode.JOB_SEARCH.

job_query Union[dict, JobQuery]

Optional. Query used to search against jobs, such as keyword, location filters, etc. If a dict is provided, it must be of the same form as the protobuf message JobQuery

enable_broadening bool

Optional. Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list. Defaults to false.

require_precise_result_size bool

Optional. Controls if the search job request requires the return of a precise count of the first 300 results. Setting this to true ensures consistency in the number of results per page. Best practice is to set this value to true if a client allows users to jump directly to a non-sequential search results page. Enabling this flag may adversely impact performance. Defaults to false.

histogram_queries list[Union[dict, HistogramQuery]]

Optional. An expression specifies a histogram request against matching jobs. Expression syntax is an aggregation function call with histogram facets and other options. Available aggregation function calls are: - count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value. - count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket. Data types: - Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. - String: string like "any string with backslash escape for quote(")." - Number: whole number and floating point number like 10, -1 and -0.01. - List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"]. Built-in constants: - MIN (minimum number similar to java Double.MIN_VALUE) - MAX (maximum number similar to java Double.MAX_VALUE) Built-in functions: - bucket(start, end[, label]): bucket built-in function creates a bucket with range of <code>start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10). Job histogram facets: - company_display_name: histogram by [Job.company_display_name</code>. - employment_type: histogram by Job.employment_types, for example, "FULL_TIME", "PART_TIME". - company_size: histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG". - publish_time_in_month: histogram by the Job.posting_publish_time in months. Must specify list of numeric buckets in spec. - publish_time_in_year: histogram by the Job.posting_publish_time in years. Must specify list of numeric buckets in spec. - degree_types: histogram by the Job.degree_types, for example, "Bachelors", "Masters". - job_level: histogram by the Job.job_level, for example, "Entry Level". - country: histogram by the country code of jobs, for example, "US", "FR". - admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL". - city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY". - admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US". - city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically. - locale: histogram by the Job.language_code, for example, "en-US", "fr-FR". - language: histogram by the language subtag of the Job.language_code, for example, "en", "fr". - category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE". - base_compensation_unit: histogram by the CompensationInfo.CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY". - base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by. - annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by. - annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by. - string_custom_attribute: histogram by string Job.custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"]. - numeric_custom_attribute: histogram by numeric Job.custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by. Example expressions: - count(admin1) - count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)]) - count(string_custom_attribute["some-string-custom-attribute"]) - count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"]) If a dict is provided, it must be of the same form as the protobuf message HistogramQuery

job_view JobView

Optional. The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_SMALL if no value is specified.

offset int

Optional. An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset. For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page).

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

order_by str

Optional. The criteria determining how search results are sorted. Default is "relevance desc". Supported options are: - "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering. - "posting_publish_time desc": By Job.posting_publish_time descending. - "posting_update_time desc": By Job.posting_update_time descending. - "title": By Job.title ascending. - "title desc": By Job.title descending. - "annualized_base_compensation": By job's CompensationInfo.annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_base_compensation desc": By job's CompensationInfo.annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_total_compensation": By job's CompensationInfo.annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "annualized_total_compensation desc": By job's CompensationInfo.annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. - "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest.CustomRankingInfo.ranking_expression with weight factor assigned by SearchJobsRequest.CustomRankingInfo.importance_level in descending order. - Location sorting: Use the special syntax to order jobs by distance: "distance_from('Hawaii')": Order by distance from Hawaii. "distance_from(19.89, 155.5)": Order by distance from a coordinate. "distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below. "distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below. The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.

diversification_level DiversificationLevel

Optional. Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results. Defaults to DiversificationLevel.SIMPLE if no value is specified.

custom_ranking_info Union[dict, CustomRankingInfo]

Optional. Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). If a dict is provided, it must be of the same form as the protobuf message CustomRankingInfo

disable_keyword_match bool

Optional. Controls whether to disable exact keyword match on Job.title, Job.description, Job.company_display_name, Job.addresses, Job.qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Use Company.keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

tenant_path

tenant_path(project, tenant)

Return a fully-qualified tenant string.

update_job

update_job(job, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Updates specified job.

Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.

.. rubric:: Example

from google.cloud import talent_v4beta1

client = talent_v4beta1.JobServiceClient()

TODO: Initialize job:

job = {}

response = client.update_job(job)

Parameters
NameDescription
job Union[dict, Job]

Required. The Job to be updated. If a dict is provided, it must be of the same form as the protobuf message Job

update_mask Union[dict, FieldMask]

Optional but strongly recommended to be provided for the best service experience. If update_mask is provided, only the specified fields in job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will not be retried.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.