yellowdog_client.compute – Compute

All functionality is accessed via the yellowdog_client.compute.ComputeClient.

class yellowdog_client.compute.ComputeClient

The API interface exposed by the YellowDog Compute Service

abstract add_compute_requirement(compute_requirement)

Submits a NEW requirement to YellowDog Compute to be initialised and provisioned.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to submit to YellowDog Compute

Return type:

ComputeRequirement

Returns:

the initialised requirement returned from YellowDog Compute

abstract add_compute_requirement_listener(compute_requirement, listener)

Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.

Parameters:
  • compute_requirement (ComputeRequirement) – the requirement for which to receive notifications

  • listener (SubscriptionEventListener[ComputeRequirement]) – the event listener that will be invoked for notifications

Return type:

None

abstract add_compute_requirement_listener_by_id(compute_requirement_id, listener)

Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.

Parameters:
  • compute_requirement_id (str) – the ID of the requirement for which to receive notifications

  • listener (SubscriptionEventListener[ComputeRequirement]) – the event listener that will be invoked for notifications

Return type:

None

abstract add_compute_requirement_template(compute_requirement_template)
Parameters:

compute_requirement_template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

abstract add_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

abstract delete_compute_requirement_template(compute_requirement_template)
Parameters:

compute_requirement_template (ComputeRequirementTemplate)

Return type:

None

abstract delete_compute_requirement_template_by_id(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

None

abstract delete_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

None

abstract delete_compute_source_template_by_id(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

None

abstract deprovision_instances(compute_requirement, instances)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement’s instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

abstract deprovision_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement’s instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

abstract find_all_compute_requirement_templates()

Returns summaries of all existing compute requirement templates within the system for the requesting user.

Return type:

List[ComputeRequirementTemplateSummary]

Returns:

a list of compute requirement template summaries

abstract find_all_compute_source_templates()
Return type:

List[ComputeSourceTemplateSummary]

abstract get_best_compute_source_report_by_compute_requirement(provisioned_compute_requirement_id)

Gets the provision report for a compute requirement provisioned from a dynamic template.

Parameters:

provisioned_compute_requirement_id (str) – the ID of the provisioned compute requirement

Return type:

BestComputeSourceReport

Returns:

the provision report for a compute requirement provisioned from a dynamic template

abstract get_compute_requirement(compute_requirement)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:

compute_requirement (ComputeRequirement) – the requirement for which to get the latest view

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract get_compute_requirement_by_id(compute_requirement_id)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:

compute_requirement_id (str) – the ID of the requirement

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract get_compute_requirement_by_name(namespace, compute_requirement_name)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:
  • namespace (str) – the namespace containing the requirement

  • compute_requirement_name (str) – the name of the requirement

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract get_compute_requirement_helper(compute_requirement)

Constructs a new compute requirement helper for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the compute requirement for which the helper will be constructed

Return type:

ComputeRequirementHelper

Returns:

a new compute requirement helper

abstract get_compute_requirement_helper_by_id(compute_requirement_id)

Constructs a new compute requirement helper for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the compute requirement for which the helper will be constructed

Return type:

ComputeRequirementHelper

Returns:

a new compute requirement helper

abstract get_compute_requirement_summaries(compute_requirement_summary_search)
Parameters:

compute_requirement_summary_search (ComputeRequirementSummarySearch)

Return type:

SearchClient[ComputeRequirementSummary]

abstract get_compute_requirement_template(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

ComputeRequirementTemplate

abstract get_compute_requirement_template_by_id(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

ComputeRequirementTemplate

abstract get_compute_requirement_template_by_name(namespace, name)
Parameters:
Return type:

ComputeRequirementTemplate

abstract get_compute_requirements(compute_requirement_search)

Returns a search client for searching compute requirements.

Parameters:

compute_requirement_search (ComputeRequirementSearch) – the search criteria

Return type:

SearchClient[ComputeRequirement]

Returns:

a search client for searching compute requirements

@deprecated use #getComputeRequirementSummaries(ComputeRequirementSummarySearch) instead.

abstract get_compute_source_template(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

ComputeSourceTemplate

abstract get_instances(instance_search)

Returns a search client for searching instances.

Parameters:

instance_search (InstanceSearch) – the search criteria

Return type:

SearchClient[Instance]

Returns:

a search client for searching instances

abstract is_compute_requirement_updating(compute_requirement)

Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to check

Return type:

bool

Returns:

true, if the requirement is being updated by YellowDog Compute; otherwise, false

abstract is_compute_requirement_updating_by_id(compute_requirement_id)

Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.

Parameters:

compute_requirement_id (str) – the ID of the requirement to check

Return type:

bool

Returns:

true, if the requirement is being updated by YellowDog Compute; otherwise, false

abstract provision_compute_requirement_template(compute_requirement_template_usage)

Provisions a new compute requirement based on the specified template and requirement properties.

Parameters:

compute_requirement_template_usage (ComputeRequirementTemplateUsage) – An object defining the template ID and requirement properties

Return type:

ComputeRequirement

Returns:

the provisioned compute requirement

abstract remove_compute_requirement_listener(listener)

Removes the specified event listener. The client manages subscriptions to YellowDog Compute such that when the last listener for a requirement is removed, the associated Server-Sent Events subscription is cancelled.

Parameters:

listener (SubscriptionEventListener[ComputeRequirement]) – the event listener that will no longer be invoked for notifications

Return type:

None

abstract reprovision_compute_requirement(compute_requirement)

Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract reprovision_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.

Parameters:

compute_requirement_id (str) – the ID of the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract restart_instances(compute_requirement, instances)

Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus#RUNNING, InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract restart_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus#RUNNING, InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract start_compute_requirement(compute_requirement)

Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to start

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract start_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to start

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract start_instances(compute_requirement, instances)

Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract start_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract stop_compute_requirement(compute_requirement)

Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to stop

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract stop_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to stop

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract stop_instances(compute_requirement, instances)

Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus#RUNNING or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract stop_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus#RUNNING or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

abstract terminate_compute_requirement(compute_requirement)

Instructs YellowDog Compute to terminate the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract terminate_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to terminate the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract terminate_instances(compute_requirement, instances)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

abstract terminate_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

abstract test_compute_requirement_template(compute_requirement_template_usage)

Generates a new compute requirement based on the specified template and requirement properties. Includes other related information such as a BestComputeSourceReport if relevant.

Parameters:

compute_requirement_template_usage (ComputeRequirementTemplateUsage) – An object defining the template ID and requirement properties

Return type:

ComputeRequirementTemplateTestResult

Returns:

the template test result

abstract update_compute_requirement(compute_requirement, reprovision=None)

Submits an existing requirement to YellowDog Compute in order to provision any changes.

Parameters:
  • compute_requirement (ComputeRequirement) – the requirement to submit to YellowDog Compute

  • reprovision (Optional[bool]) – indicates that YellowDog Compute should provision instances to restore the instance count even if targetInstanceCount is unchanged

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

abstract update_compute_requirement_template(compute_requirement_template)
Parameters:

compute_requirement_template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

abstract update_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

class yellowdog_client.compute.ComputeClientImpl(service_proxy)
Parameters:

service_proxy (ComputeServiceProxy)

add_compute_requirement(compute_requirement)

Submits a NEW requirement to YellowDog Compute to be initialised and provisioned.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to submit to YellowDog Compute

Return type:

ComputeRequirement

Returns:

the initialised requirement returned from YellowDog Compute

add_compute_requirement_listener(compute_requirement, listener)

Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.

Parameters:
  • compute_requirement (ComputeRequirement) – the requirement for which to receive notifications

  • listener (SubscriptionEventListener) – the event listener that will be invoked for notifications

Return type:

None

add_compute_requirement_listener_by_id(compute_requirement_id, listener)

Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.

Parameters:
  • compute_requirement_id (str) – the ID of the requirement for which to receive notifications

  • listener (SubscriptionEventListener) – the event listener that will be invoked for notifications

Return type:

None

add_compute_requirement_template(template)
Parameters:

template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

add_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

close()
Return type:

None

delete_compute_requirement_template(compute_requirement_template)
Parameters:

compute_requirement_template (ComputeRequirementTemplate)

Return type:

None

delete_compute_requirement_template_by_id(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

None

delete_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

None

delete_compute_source_template_by_id(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

None

deprovision_instances(compute_requirement, instances)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement’s instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

deprovision_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement’s instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

find_all_compute_requirement_templates()

Returns summaries of all existing compute requirement templates within the system for the requesting user.

Return type:

List[ComputeRequirementTemplateSummary]

Returns:

a list of compute requirement template summaries

find_all_compute_source_templates()
Return type:

List[ComputeSourceTemplateSummary]

get_best_compute_source_report_by_compute_requirement(provisioned_requirement_id)

Gets the provision report for a compute requirement provisioned from a dynamic template.

Parameters:
  • provisioned_compute_requirement_id – the ID of the provisioned compute requirement

  • provisioned_requirement_id (str)

Return type:

BestComputeSourceReport

Returns:

the provision report for a compute requirement provisioned from a dynamic template

get_compute_requirement(compute_requirement)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:

compute_requirement (ComputeRequirement) – the requirement for which to get the latest view

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

get_compute_requirement_by_id(compute_requirement_id)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:

compute_requirement_id (str) – the ID of the requirement

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

get_compute_requirement_by_name(namespace, compute_requirement_name)

Requests the latest view of the specified requirement from YellowDog Compute.

Parameters:
  • namespace (str) – the namespace containing the requirement

  • compute_requirement_name (str) – the name of the requirement

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

get_compute_requirement_helper(compute_requirement)

Constructs a new compute requirement helper for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the compute requirement for which the helper will be constructed

Return type:

ComputeRequirementHelper

Returns:

a new compute requirement helper

get_compute_requirement_helper_by_id(compute_requirement_id)

Constructs a new compute requirement helper for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the compute requirement for which the helper will be constructed

Return type:

ComputeRequirementHelper

Returns:

a new compute requirement helper

get_compute_requirement_summaries(compute_requirement_summary_search)
Parameters:

compute_requirement_summary_search (ComputeRequirementSummarySearch)

Return type:

SearchClient[ComputeRequirementSummary]

get_compute_requirement_template(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

ComputeRequirementTemplate

get_compute_requirement_template_by_id(compute_requirement_template_id)
Parameters:

compute_requirement_template_id (str)

Return type:

ComputeRequirementTemplate

get_compute_requirement_template_by_name(namespace, name)
Parameters:
Return type:

ComputeRequirementTemplate

get_compute_requirements(compute_requirement_search)

Returns a search client for searching compute requirements.

Parameters:

compute_requirement_search (ComputeRequirementSearch) – the search criteria

Return type:

SearchClient[ComputeRequirement]

Returns:

a search client for searching compute requirements

@deprecated use #getComputeRequirementSummaries(ComputeRequirementSummarySearch) instead.

get_compute_source_template(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

ComputeSourceTemplate

get_instances(instance_search)

Returns a search client for searching instances.

Parameters:

instance_search (InstanceSearch) – the search criteria

Return type:

SearchClient[Instance]

Returns:

a search client for searching instances

is_compute_requirement_updating(compute_requirement)

Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to check

Return type:

bool

Returns:

true, if the requirement is being updated by YellowDog Compute; otherwise, false

is_compute_requirement_updating_by_id(compute_requirement_id)

Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.

Parameters:

compute_requirement_id (str) – the ID of the requirement to check

Return type:

bool

Returns:

true, if the requirement is being updated by YellowDog Compute; otherwise, false

provision_compute_requirement_template(template_request)

Provisions a new compute requirement based on the specified template and requirement properties.

Parameters:
Return type:

ComputeRequirement

Returns:

the provisioned compute requirement

remove_compute_requirement_listener(listener)

Removes the specified event listener. The client manages subscriptions to YellowDog Compute such that when the last listener for a requirement is removed, the associated Server-Sent Events subscription is cancelled.

Parameters:

listener (SubscriptionEventListener[ComputeRequirement]) – the event listener that will no longer be invoked for notifications

reprovision_compute_requirement(compute_requirement)

Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

reprovision_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.

Parameters:

compute_requirement_id (str) – the ID of the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

restart_instances(compute_requirement, instances)

Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus#RUNNING, InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

restart_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus#RUNNING, InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

start_compute_requirement(compute_requirement)

Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to start

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

start_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to start

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

start_instances(compute_requirement, instances)

Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

start_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus#STOPPED or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

stop_compute_requirement(compute_requirement)

Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to stop

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

stop_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to stop

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

stop_instances(compute_requirement, instances)

Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus#RUNNING or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

stop_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus#RUNNING or InstanceStatus#UNKNOWN.

Parameters:
Return type:

None

terminate_compute_requirement(compute_requirement)

Instructs YellowDog Compute to terminate the specified requirement.

Parameters:

compute_requirement (ComputeRequirement) – the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

terminate_compute_requirement_by_id(compute_requirement_id)

Instructs YellowDog Compute to terminate the specified requirement.

Parameters:

compute_requirement_id (str) – the ID of the requirement to terminate

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

terminate_instances(compute_requirement, instances)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

terminate_instances_by_id(compute_requirement, instance_ids)

Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus#TERMINATING.

Parameters:
Return type:

None

test_compute_requirement_template(template_usage)

Generates a new compute requirement based on the specified template and requirement properties. Includes other related information such as a BestComputeSourceReport if relevant.

Parameters:
Return type:

ComputeRequirementTemplateTestResult

Returns:

the template test result

update_compute_requirement(compute_requirement, reprovision=False)

Submits an existing requirement to YellowDog Compute in order to provision any changes.

Parameters:
  • compute_requirement (ComputeRequirement) – the requirement to submit to YellowDog Compute

  • reprovision (bool) – indicates that YellowDog Compute should provision instances to restore the instance count even if targetInstanceCount is unchanged

Return type:

ComputeRequirement

Returns:

the latest view of the requirement returned from YellowDog Compute

update_compute_requirement_template(compute_requirement_template)
Parameters:

compute_requirement_template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

update_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

class yellowdog_client.compute.ComputeRequirementHelper(compute_requirement, compute_service_client_impl)

This class provides a number of methods that return a concurrent.futures.Future allowing consumers to simply wait for the required state of a compute requirement before continuing on.

Constructor accepts the following arguments:

Parameters:
when_requirement_matches(predicate)

Returns a concurrent.futures.Future that is completed when the specified predicate evaluates to true.

Parameters:

predicate (Callable[[yellowdog_client.model.ComputeRequirement], bool]) – The predicate to test for each compute requirement changed event received.

Returns:

A concurrent.futures.Future containing the matching compute requirement.

Return type:

concurrent.futures.Future

from concurrent import futures
from yellowdog_client.model import ComputeRequirementStatus

future = helper.when_requirement_matches(lambda req:  req.status == ComputeRequirementStatus.TERMINATED)

futures.wait(fs=(future,))
future_compute_requirement = future.result()
# ComputeRequirement
when_requirement_status_is(status)

Returns a task that is completed when the compute requirement status matches the specified status.

Parameters:

status (yellowdog_client.model.ComputeRequirementStatus) – The compute requirement status to wait for.

Returns:

A concurrent.futures.Future containing the matching compute requirement.

Return type:

concurrent.futures.Future

from concurrent import futures
from yellowdog_client.model import ComputeRequirementStatus

future = helper.when_requirement_status_is(ComputeRequirementStatus.RUNNING)

futures.wait(fs=(future,))
future_compute_requirement = future.result()
# ComputeRequirement
class yellowdog_client.compute.ComputeServiceProxy(proxy)
Parameters:

proxy (Proxy)

add_compute_requirement(compute_requirement)
Parameters:

compute_requirement (ComputeRequirement)

Return type:

ComputeRequirement

add_compute_requirement_template(template)
Parameters:

template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

add_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

delete_compute_requirement_template(template_id)
Parameters:

template_id (str)

Return type:

None

delete_compute_source_template(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

None

deprovision_instances(compute_requirement, instance_ids)
Parameters:
Return type:

None

find_all_compute_requirement_templates()
Return type:

List[ComputeRequirementTemplateSummary]

find_all_compute_source_templates()
Return type:

List[ComputeSourceTemplateSummary]

get_best_compute_source_report_by_requirement_id(provisioned_requirement_id)
Parameters:

provisioned_requirement_id (str)

Return type:

BestComputeSourceReport

get_compute_requirement_by_id(compute_requirement_id)
Parameters:

compute_requirement_id (str)

Return type:

ComputeRequirement

get_compute_requirement_by_name(namespace, compute_requirement_name)
Parameters:
  • namespace (str)

  • compute_requirement_name (str)

Return type:

ComputeRequirement

get_compute_requirement_template_by_id(template_id)
Parameters:

template_id (str)

Return type:

ComputeRequirementTemplate

get_compute_requirement_template_by_name(namespace, name)
Parameters:
Return type:

ComputeRequirementTemplate

get_compute_source_template_by_id(compute_source_template_id)
Parameters:

compute_source_template_id (str)

Return type:

ComputeSourceTemplate

is_compute_requirement_updating(compute_requirement_id)
Parameters:

compute_requirement_id (str)

Return type:

bool

provision_compute_requirement_template(usage)
Parameters:

usage (ComputeRequirementTemplateUsage)

Return type:

ComputeRequirement

search_compute_requirement_summaries(search, slice_reference)
Parameters:
Return type:

Slice[ComputeRequirementSummary]

search_compute_requirements(search, slice_reference)
Parameters:
Return type:

Slice[ComputeRequirement]

search_instances(search, slice_reference)
Parameters:
Return type:

Slice[Instance]

stream_compute_requirement_updates(compute_requirement_id)
Parameters:

compute_requirement_id (str)

Return type:

EventSource

test_compute_requirement_template(template_usage)
Parameters:

template_usage (ComputeRequirementTemplateUsage)

Return type:

ComputeRequirementTemplateTestResult

transition_compute_requirement(compute_requirement_id, next_status)
Parameters:
transition_instances(compute_requirement, next_status, instance_ids)
Parameters:
Return type:

None

update_compute_requirement(compute_requirement, reprovision)
Parameters:
update_compute_requirement_template(template)
Parameters:

template (ComputeRequirementTemplate)

Return type:

ComputeRequirementTemplate

update_compute_source_template(compute_source_template)
Parameters:

compute_source_template (ComputeSourceTemplate)

Return type:

ComputeSourceTemplate

class yellowdog_client.compute.PredicatedComputeSubscriptionEventListener(future, predicate, compute_client)
Parameters:
subscription_cancelled()

Invoked if the server cancels the subscription associated with this listener

Return type:

None

subscription_error(error)

Invoked if an error occurs on the subscription associated with this listener.

Parameters:

error (Exception) – the error that occurred

Return type:

None

updated(obj)

Invoked when an updated instance of the object is received from YellowDog Platform.

Parameters:

obj (ComputeRequirement) – an updated instance of the object for which the listener was registered

Return type:

None