toil.provisioners.gceProvisioner¶
Attributes¶
Exceptions¶
Indicates that the specified cluster does not exist. |
Classes¶
Represents the physical storage for the jobs and files in a Toil workflow. |
|
Interface for provisioning worker nodes to use in a Toil cluster. |
|
Represents a job or a node's "shape", in terms of the dimensions of memory, cores, disk and |
|
Implements a Google Compute Engine Provisioner using libcloud. |
Functions¶
|
Given a string representation of some memory (i.e. '1024 Mib'), return the |
|
Convert a tree of objects over bytes to objects over strings. |
Module Contents¶
- class toil.provisioners.gceProvisioner.GoogleJobStore(locator)¶
Bases:
toil.jobStores.abstractJobStore.AbstractJobStoreRepresents the physical storage for the jobs and files in a Toil workflow.
JobStores are responsible for storing
toil.job.JobDescription(which relate jobs to each other) and files.Actual
toil.job.Jobobjects are stored in files, referenced by JobDescriptions. All the non-file CRUD methods the JobStore provides deal in JobDescriptions and not full, executable Jobs.To actually get ahold of a
toil.job.Job, usetoil.job.Job.loadJob()with a JobStore and the relevant JobDescription.- Parameters:
locator (str)
- nodeServiceAccountJson = '/root/service_account.json'¶
- classmethod create_client()¶
Produce a client for Google Sotrage with the highest level of access we can get.
Fall back to anonymous access if no project is available, unlike the Google Storage module’s behavior.
Warn if GOOGLE_APPLICATION_CREDENTIALS is set but not actually present.
- Return type:
google.cloud.storage.Client
- initialize(config=None)¶
Initialize this job store.
Create the physical storage for this job store, allocate a workflow ID and persist the given Toil configuration to the store.
- Parameters:
config – the Toil configuration to initialize this job store with. The given configuration will be updated with the newly allocated workflow ID.
- Raises:
JobStoreExistsException – if the physical storage for this job store already exists
- resume()¶
Connect this instance to the physical storage it represents and load the Toil configuration into the
AbstractJobStore.configattribute.- Raises:
NoSuchJobStoreException – if the physical storage for this job store doesn’t exist
- destroy()¶
The inverse of
initialize(), this method deletes the physical storage represented by this instance. While not being atomic, this method is at least idempotent, as a means to counteract potential issues with eventual consistency exhibited by the underlying storage mechanisms. This means that if the method fails (raises an exception), it may (and should be) invoked again. If the underlying storage mechanism is eventually consistent, even a successful invocation is not an ironclad guarantee that the physical storage vanished completely and immediately. A successful invocation only guarantees that the deletion will eventually happen. It is therefore recommended to not immediately reuse the same job store location for a new Toil workflow.
- assign_job_id(job_description)¶
Get a new jobStoreID to be used by the described job, and assigns it to the JobDescription.
Files associated with the assigned ID will be accepted even if the JobDescription has never been created or updated.
- Parameters:
job_description (toil.job.JobDescription) – The JobDescription to give an ID to
- batch()¶
If supported by the batch system, calls to create() with this context manager active will be performed in a batch after the context manager is released.
- create_job(job_description)¶
Writes the given JobDescription to the job store. The job must have an ID assigned already.
Must call jobDescription.pre_update_hook()
- Returns:
The JobDescription passed.
- Return type:
- job_exists(job_id)¶
Indicates whether a description of the job with the specified jobStoreID exists in the job store
- Return type:
- get_public_url(fileName)¶
Returns a publicly accessible URL to the given file in the job store. The returned URL may expire as early as 1h after its been returned. Throw an exception if the file does not exist.
- Parameters:
file_name (str) – the jobStoreFileID of the file to generate a URL for
- Raises:
NoSuchFileException – if the specified file does not exist in this job store
- Return type:
Differs from
getPublicUrl()in that this method is for generating URLs for shared files written bywriteSharedFileStream().Returns a publicly accessible URL to the given file in the job store. The returned URL starts with ‘http:’, ‘https:’ or ‘file:’. The returned URL may expire as early as 1h after its been returned. Throw an exception if the file does not exist.
- Parameters:
shared_file_name (str) – The name of the shared file to generate a publically accessible url for.
- Raises:
NoSuchFileException – raised if the specified file does not exist in the store
- Return type:
- load_job(job_id)¶
Loads the description of the job referenced by the given ID, assigns it the job store’s config, and returns it.
May declare the job to have failed (see
toil.job.JobDescription.setupJobAfterFailure()) if there is evidence of a failed update attempt.- Parameters:
job_id – the ID of the job to load
- Raises:
NoSuchJobException – if there is no job with the given ID
- update_job(job)¶
Persists changes to the state of the given JobDescription in this store atomically.
Must call jobDescription.pre_update_hook()
- Parameters:
job (toil.job.JobDescription) – the job to write to this job store
- delete_job(job_id)¶
Removes the JobDescription from the store atomically. You may not then subsequently call load(), write(), update(), etc. with the same jobStoreID or any JobDescription bearing it.
This operation is idempotent, i.e. deleting a job twice or deleting a non-existent job will succeed silently.
- Parameters:
job_id (str) – the ID of the job to delete from this job store
- get_env()¶
Return a dict of environment variables to send out to the workers so they can load the job store.
- jobs()¶
Best effort attempt to return iterator on JobDescriptions for all jobs in the store. The iterator may not return all jobs and may also contain orphaned jobs that have already finished successfully and should not be rerun. To guarantee you get any and all jobs that can be run instead construct a more expensive ToilState object
- Returns:
Returns iterator on jobs in the store. The iterator may or may not contain all jobs and may contain invalid jobs
- Return type:
Iterator[toil.job.jobDescription]
- write_file(local_path, job_id=None, cleanup=False)¶
Takes a file (as a path) and places it in this job store. Returns an ID that can be used to retrieve the file at a later time. The file is written in a atomic manner. It will not appear in the jobStore until the write has successfully completed.
- Parameters:
local_path (str) – the path to the local file that will be uploaded to the job store. The last path component (basename of the file) will remain associated with the file in the file store, if supported, so that the file can be searched for by name or name glob.
job_id (str) – the id of a job, or None. If specified, the may be associated with that job in a job-store-specific way. This may influence the returned ID.
cleanup (bool) – Whether to attempt to delete the file when the job whose jobStoreID was given as jobStoreID is deleted with jobStore.delete(job). If jobStoreID was not given, does nothing.
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
NoSuchJobException – if the job specified via jobStoreID does not exist
FIXME: some implementations may not raise this
- Returns:
an ID referencing the newly created file and can be used to read the file in the future.
- Return type:
- write_file_stream(job_id=None, cleanup=False, basename=None, encoding=None, errors=None)¶
Similar to writeFile, but returns a context manager yielding a tuple of 1) a file handle which can be written to and 2) the ID of the resulting file in the job store. The yielded file handle does not need to and should not be closed explicitly. The file is written in a atomic manner. It will not appear in the jobStore until the write has successfully completed.
- Parameters:
job_id (str) – the id of a job, or None. If specified, the may be associated with that job in a job-store-specific way. This may influence the returned ID.
cleanup (bool) – Whether to attempt to delete the file when the job whose jobStoreID was given as jobStoreID is deleted with jobStore.delete(job). If jobStoreID was not given, does nothing.
basename (str) – If supported by the implementation, use the given file basename so that when searching the job store with a query matching that basename, the file will be detected.
encoding (str) – the name of the encoding used to encode the file. Encodings are the same as for encode(). Defaults to None which represents binary mode.
errors (str) – an optional string that specifies how encoding errors are to be handled. Errors are the same as for open(). Defaults to ‘strict’ when an encoding is specified.
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
NoSuchJobException – if the job specified via jobStoreID does not exist
FIXME: some implementations may not raise this
- get_empty_file_store_id(jobStoreID=None, cleanup=False, basename=None)¶
Creates an empty file in the job store and returns its ID. Call to fileExists(getEmptyFileStoreID(jobStoreID)) will return True.
- Parameters:
job_id (str) – the id of a job, or None. If specified, the may be associated with that job in a job-store-specific way. This may influence the returned ID.
cleanup (bool) – Whether to attempt to delete the file when the job whose jobStoreID was given as jobStoreID is deleted with jobStore.delete(job). If jobStoreID was not given, does nothing.
basename (str) – If supported by the implementation, use the given file basename so that when searching the job store with a query matching that basename, the file will be detected.
- Returns:
a jobStoreFileID that references the newly created file and can be used to reference the file in the future.
- Return type:
- read_file(file_id, local_path, symlink=False)¶
Copies or hard links the file referenced by jobStoreFileID to the given local file path. The version will be consistent with the last copy of the file written/updated. If the file in the job store is later modified via updateFile or updateFileStream, it is implementation-defined whether those writes will be visible at localFilePath. The file is copied in an atomic manner. It will not appear in the local file system until the copy has completed.
The file at the given local path may not be modified after this method returns!
Note! Implementations of readFile need to respect/provide the executable attribute on FileIDs.
- Parameters:
file_id (str) – ID of the file to be copied
local_path (str) – the local path indicating where to place the contents of the given file in the job store
symlink (bool) – whether the reader can tolerate a symlink. If set to true, the job store may create a symlink instead of a full copy of the file or a hard link.
- read_file_stream(file_id, encoding=None, errors=None)¶
Similar to readFile, but returns a context manager yielding a file handle which can be read from. The yielded file handle does not need to and should not be closed explicitly.
- Parameters:
file_id (str) – ID of the file to get a readable file handle for
encoding (str) – the name of the encoding used to decode the file. Encodings are the same as for decode(). Defaults to None which represents binary mode.
errors (str) – an optional string that specifies how encoding errors are to be handled. Errors are the same as for open(). Defaults to ‘strict’ when an encoding is specified.
- Returns:
a context manager yielding a file handle which can be read from
- Return type:
- delete_file(file_id)¶
Deletes the file with the given ID from this job store. This operation is idempotent, i.e. deleting a file twice or deleting a non-existent file will succeed silently.
- Parameters:
file_id (str) – ID of the file to delete
- file_exists(file_id)¶
Determine whether a file exists in this job store.
- Parameters:
file_id – an ID referencing the file to be checked
- get_file_size(file_id)¶
Get the size of the given file in bytes, or 0 if it does not exist when queried.
Note that job stores which encrypt files might return overestimates of file sizes, since the encrypted file may have been padded to the nearest block, augmented with an initialization vector, etc.
- update_file(file_id, local_path)¶
Replaces the existing version of a file in the job store.
Throws an exception if the file does not exist.
- Parameters:
file_id – the ID of the file in the job store to be updated
local_path – the local path to a file that will overwrite the current version in the job store
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
NoSuchFileException – if the specified file does not exist
- update_file_stream(file_id, encoding=None, errors=None)¶
Replaces the existing version of a file in the job store. Similar to writeFile, but returns a context manager yielding a file handle which can be written to. The yielded file handle does not need to and should not be closed explicitly.
- Parameters:
file_id (str) – the ID of the file in the job store to be updated
encoding (str) – the name of the encoding used to encode the file. Encodings are the same as for encode(). Defaults to None which represents binary mode.
errors (str) – an optional string that specifies how encoding errors are to be handled. Errors are the same as for open(). Defaults to ‘strict’ when an encoding is specified.
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
NoSuchFileException – if the specified file does not exist
Returns a context manager yielding a writable file handle to the global file referenced by the given name. File will be created in an atomic manner.
- Parameters:
shared_file_name (str) – A file name matching AbstractJobStore.fileNameRegex, unique within this job store
encrypted (bool) – True if the file must be encrypted, None if it may be encrypted or False if it must be stored in the clear.
encoding (str) – the name of the encoding used to encode the file. Encodings are the same as for encode(). Defaults to None which represents binary mode.
errors (str) – an optional string that specifies how encoding errors are to be handled. Errors are the same as for open(). Defaults to ‘strict’ when an encoding is specified.
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
- Returns:
a context manager yielding a writable file handle
- Return type:
Iterator[IO[bytes]]
Returns a context manager yielding a readable file handle to the global file referenced by the given name.
- Parameters:
shared_file_name (str) – A file name matching AbstractJobStore.fileNameRegex, unique within this job store
encoding (str) – the name of the encoding used to decode the file. Encodings are the same as for decode(). Defaults to None which represents binary mode.
errors (str) – an optional string that specifies how encoding errors are to be handled. Errors are the same as for open(). Defaults to ‘strict’ when an encoding is specified.
- Returns:
a context manager yielding a readable file handle
- Return type:
Iterator[IO[bytes]]
- write_logs(msg)¶
Stores a message as a log in the jobstore.
- Parameters:
msg (str) – the string to be written
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
- Return type:
None
- read_logs(callback, read_all=False)¶
Reads logs accumulated by the write_logs() method. For each log this method calls the given callback function with the message as an argument (rather than returning logs directly, this method must be supplied with a callback which will process log messages).
Only unread logs will be read unless the read_all parameter is set.
- Parameters:
callback (Callable) – a function to be applied to each of the stats file handles found
read_all (bool) – a boolean indicating whether to read the already processed stats files in addition to the unread stats files
- Raises:
ConcurrentFileModificationException – if the file was modified concurrently during an invocation of this method
- Returns:
the number of stats files processed
- Return type:
- toil.provisioners.gceProvisioner.human2bytes(string)¶
Given a string representation of some memory (i.e. ‘1024 Mib’), return the integer number of bytes.
- toil.provisioners.gceProvisioner.compat_bytes_recursive(data)¶
Convert a tree of objects over bytes to objects over strings.
- Parameters:
data (Any)
- Return type:
Any
- exception toil.provisioners.gceProvisioner.NoSuchClusterException(cluster_name)¶
Bases:
ExceptionIndicates that the specified cluster does not exist.
- Parameters:
cluster_name (str)
- class toil.provisioners.gceProvisioner.AbstractProvisioner(clusterName=None, clusterType='mesos', zone=None, nodeStorage=50, nodeStorageOverrides=None, enable_fuse=False)¶
Bases:
abc.ABCInterface for provisioning worker nodes to use in a Toil cluster.
- Parameters:
- LEADER_HOME_DIR = '/root/'¶
- abstract supportedClusterTypes()¶
Get all the cluster types that this provisioner implementation supports.
- Return type:
Set[str]
- abstract createClusterSettings()¶
Initialize class for a new cluster, to be deployed, when running outside the cloud.
- abstract readClusterSettings()¶
Initialize class from an existing cluster. This method assumes that the instance we are running on is the leader.
Implementations must call _setLeaderWorkerAuthentication().
- setAutoscaledNodeTypes(nodeTypes)¶
Set node types, shapes and spot bids for Toil-managed autoscaling. :param nodeTypes: A list of node types, as parsed with parse_node_types.
- hasAutoscaledNodeTypes()¶
Check if node types have been configured on the provisioner (via setAutoscaledNodeTypes).
- Returns:
True if node types are configured for autoscaling, and false otherwise.
- Return type:
- getAutoscaledInstanceShapes()¶
Get all the node shapes and their named instance types that the Toil autoscaler should manage.
- static retryPredicate(e)¶
Return true if the exception e should be retried by the cluster scaler. For example, should return true if the exception was due to exceeding an API rate limit. The error will be retried with exponential backoff.
- Parameters:
e – exception raised during execution of setNodeCount
- Returns:
boolean indicating whether the exception e should be retried
- abstract launchCluster(*args, **kwargs)¶
Initialize a cluster and create a leader node.
Implementations must call _setLeaderWorkerAuthentication() with the leader so that workers can be launched.
- Parameters:
leaderNodeType – The leader instance.
leaderStorage – The amount of disk to allocate to the leader in gigabytes.
owner – Tag identifying the owner of the instances.
- abstract addNodes(nodeTypes, numNodes, preemptible, spotBid=None)¶
Used to add worker nodes to the cluster
- Parameters:
- Returns:
number of nodes successfully added
- Return type:
- addManagedNodes(nodeTypes, minNodes, maxNodes, preemptible, spotBid=None)¶
Add a group of managed nodes of the given type, up to the given maximum. The nodes will automatically be launched and terminated depending on cluster load.
Raises ManagedNodesNotSupportedException if the provisioner implementation or cluster configuration can’t have managed nodes.
- Parameters:
minNodes – The minimum number of nodes to scale to
maxNodes – The maximum number of nodes to scale to
preemptible – whether or not the nodes will be preemptible
spotBid – The bid for preemptible nodes if applicable (this can be set in config, also).
nodeTypes (Set[str])
- Return type:
None
- abstract terminateNodes(nodes)¶
Terminate the nodes represented by given Node objects
- Parameters:
nodes (List[toil.provisioners.node.Node]) – list of Node objects
- Return type:
None
- abstract getLeader()¶
- Returns:
The leader node.
- abstract getProvisionedWorkers(instance_type=None, preemptible=None)¶
Gets all nodes, optionally of the given instance type or preemptability, from the provisioner. Includes both static and autoscaled nodes.
- Parameters:
- Returns:
list of Node objects
- Return type:
- abstract getNodeShape(instance_type, preemptible=False)¶
The shape of a preemptible or non-preemptible node managed by this provisioner. The node shape defines key properties of a machine, such as its number of cores or the time between billing intervals.
- abstract destroyCluster()¶
Terminates all nodes in the specified cluster and cleans up all resources associated with the cluster. :param clusterName: identifier of the cluster to terminate.
- Return type:
None
- class InstanceConfiguration¶
Allows defining the initial setup for an instance and then turning it into an Ignition configuration for instance user data.
- addFile(path, filesystem='root', mode='0755', contents='', append=False)¶
Make a file on the instance with the given filesystem, mode, and contents.
See the storage.files section: https://github.com/kinvolk/ignition/blob/flatcar-master/doc/configuration-v2_2.md
- addUnit(name, enabled=True, contents='')¶
Make a systemd unit on the instance with the given name (including .service), and content. Units will be enabled by default.
- Unit logs can be investigated with:
systemctl status whatever.service
- or:
journalctl -xe
- getBaseInstanceConfiguration()¶
Get the base configuration for both leader and worker instances for all cluster types.
- Return type:
- addVolumesService(config)¶
Add a service to prepare and mount local scratch volumes.
- Parameters:
config (InstanceConfiguration)
- addNodeExporterService(config)¶
Add the node exporter service for Prometheus to an instance configuration.
- Parameters:
config (InstanceConfiguration)
- add_toil_service(config, role, keyPath=None, preemptible=False)¶
Add the Toil leader or worker service to an instance configuration.
Will run Mesos master or agent as appropriate in Mesos clusters. For Kubernetes clusters, will just sleep to provide a place to shell into on the leader, and shouldn’t run on the worker.
- Parameters:
role (str) – Should be ‘leader’ or ‘worker’. Will not work for ‘worker’ until leader credentials have been collected.
keyPath (str) – path on the node to a server-side encryption key that will be added to the node after it starts. The service will wait until the key is present before starting.
preemptible (bool) – Whether a worker should identify itself as preemptible or not to the scheduler.
config (InstanceConfiguration)
- getKubernetesValues(architecture='amd64')¶
Returns a dict of Kubernetes component versions and paths for formatting into Kubernetes-related templates.
- Parameters:
architecture (str)
- addKubernetesServices(config, architecture='amd64')¶
Add installing Kubernetes and Kubeadm and setting up the Kubelet to run when configured to an instance configuration. The same process applies to leaders and workers.
- Parameters:
config (InstanceConfiguration)
architecture (str)
- abstract getKubernetesAutoscalerSetupCommands(values)¶
Return Bash commands that set up the Kubernetes cluster autoscaler for provisioning from the environment supported by this provisioner.
Should only be implemented if Kubernetes clusters are supported.
- getKubernetesCloudProvider()¶
Return the Kubernetes cloud provider (for example, ‘aws’), to pass to the kubelets in a Kubernetes cluster provisioned using this provisioner.
Defaults to None if not overridden, in which case no cloud provider integration will be used.
- Returns:
Cloud provider name, or None
- Return type:
Optional[str]
- addKubernetesLeader(config)¶
Add services to configure as a Kubernetes leader, if Kubernetes is already set to be installed.
- Parameters:
config (InstanceConfiguration)
- addKubernetesWorker(config, authVars, preemptible=False)¶
Add services to configure as a Kubernetes worker, if Kubernetes is already set to be installed.
Authenticate back to the leader using the JOIN_TOKEN, JOIN_CERT_HASH, and JOIN_ENDPOINT set in the given authentication data dict.
- Parameters:
config (InstanceConfiguration) – The configuration to add services to
preemptible (bool) – Whether the worker should be labeled as preemptible or not
- class toil.provisioners.gceProvisioner.Shape(wallTime, memory, cores, disk, preemptible)¶
Represents a job or a node’s “shape”, in terms of the dimensions of memory, cores, disk and wall-time allocation.
The wallTime attribute stores the number of seconds of a node allocation, e.g. 3600 for AWS. FIXME: and for jobs?
The memory and disk attributes store the number of bytes required by a job (or provided by a node) in RAM or on disk (SSD or HDD), respectively.
- Parameters:
- class toil.provisioners.gceProvisioner.Node(publicIP, privateIP, name, launchTime, nodeType, preemptible, tags=None, use_private_ip=None)¶
- Parameters:
- maxWaitTime¶
- __str__()¶
Return str(self).
- __repr__()¶
Return repr(self).
- __hash__()¶
Return hash(self).
- remainingBillingInterval()¶
If the node has a launch time, this function returns a floating point value between 0 and 1.0 representing how far we are into the current billing cycle for the given instance. If the return value is .25, we are one quarter into the billing cycle, with three quarters remaining before we will be charged again for that instance.
Assumes a billing cycle of one hour.
- Returns:
Float from 0 -> 1.0 representing percentage of pre-paid time left in cycle.
- Return type:
- copySshKeys(keyName)¶
Copy authorized_keys file to the core user from the keyName user.
- injectFile(fromFile, toFile, role)¶
rysnc a file to the container with the given role
- extractFile(fromFile, toFile, role)¶
rysnc a file from the container with the given role
- sshAppliance(*args, **kwargs)¶
- Parameters:
args – arguments to execute in the appliance
kwargs – tty=bool tells docker whether or not to create a TTY shell for interactive SSHing. The default value is False. Input=string is passed as input to the Popen call.
- sshInstance(*args, **kwargs)¶
Run a command on the instance. Returns the binary output of the command.
- coreSSH(*args, **kwargs)¶
If strict=False, strict host key checking will be temporarily disabled. This is provided as a convenience for internal/automated functions and ought to be set to True whenever feasible, or whenever the user is directly interacting with a resource (e.g. rsync-cluster or ssh-cluster). Assumed to be False by default.
kwargs: input, tty, appliance, collectStdout, sshOptions, strict
- Parameters:
input (bytes) – UTF-8 encoded input bytes to send to the command
- toil.provisioners.gceProvisioner.logger¶
- class toil.provisioners.gceProvisioner.GCEProvisioner(clusterName, clusterType, zone, nodeStorage, nodeStorageOverrides, sseKey, enable_fuse)¶
Bases:
toil.provisioners.abstractProvisioner.AbstractProvisionerImplements a Google Compute Engine Provisioner using libcloud.
- NODE_BOTO_PATH = '/root/.boto'¶
- SOURCE_IMAGE = b'projects/kinvolk-public/global/images/family/flatcar-stable'¶
- supportedClusterTypes()¶
Get all the cluster types that this provisioner implementation supports.
- createClusterSettings()¶
Initialize class for a new cluster, to be deployed, when running outside the cloud.
- readClusterSettings()¶
Read the cluster settings from the instance, which should be the leader. See https://cloud.google.com/compute/docs/storing-retrieving-metadata for details about reading the metadata.
- launchCluster(leaderNodeType, leaderStorage, owner, **kwargs)¶
In addition to the parameters inherited from the abstractProvisioner, the Google launchCluster takes the following parameters: keyName: The key used to communicate with instances botoPath: Boto credentials for reading an AWS jobStore (optional). network: a network (optional) vpcSubnet: A subnet (optional). use_private_ip: even though a public ip exists, ignore it (optional)
- getNodeShape(instance_type, preemptible=False)¶
The shape of a preemptible or non-preemptible node managed by this provisioner. The node shape defines key properties of a machine, such as its number of cores or the time between billing intervals.
- Parameters:
instance_type (str) – Instance type name to return the shape of.
- Return type:
- static retryPredicate(e)¶
Not used by GCE
- destroyCluster()¶
Try a few times to terminate all of the instances in the group.
- Return type:
None
- terminateNodes(nodes)¶
Terminate the nodes represented by given Node objects
- Parameters:
nodes – list of Node objects
- addNodes(nodeTypes, numNodes, preemptible, spotBid=None)¶
Used to add worker nodes to the cluster
- getProvisionedWorkers(instance_type=None, preemptible=None)¶
Gets all nodes, optionally of the given instance type or preemptability, from the provisioner. Includes both static and autoscaled nodes.
- getLeader()¶
- Returns:
The leader node.
- DEFAULT_TASK_COMPLETION_TIMEOUT = 180¶
- ex_create_multiple_nodes(base_name, size, image, number, location=None, ex_network='default', ex_subnetwork=None, ex_tags=None, ex_metadata=None, ignore_errors=True, use_existing_disk=True, poll_interval=2, external_ip='ephemeral', ex_disk_type='pd-standard', ex_disk_auto_delete=True, ex_service_accounts=None, timeout=DEFAULT_TASK_COMPLETION_TIMEOUT, description=None, ex_can_ip_forward=None, ex_disks_gce_struct=None, ex_nic_gce_struct=None, ex_on_host_maintenance=None, ex_automatic_restart=None, ex_image_family=None, ex_preemptible=None)¶
Monkey patch to gce.py in libcloud to allow disk and images to be specified. Also changed name to a uuid below. The prefix ‘wp’ identifies preemptible nodes and ‘wn’ non-preemptible nodes.