try:
credentials, project_id = google.auth.default()
except google.auth.exceptions.DefaultCredentialsError:
!gcloud auth application-default login
credentials, project_id = google.auth.default()
ee.Initialize(credentials=credentials, project=project_id)core
ClusterGEE
ClusterGEE (**kwargs)
Create a Dask cluster with Coiled
InitEarthEngine
InitEarthEngine (**kwargs)
*Interface to extend the Worker
A worker plugin enables custom code to run at different stages of the Workers’ lifecycle.
A plugin enables custom code to run at each of step of a Workers’s life. Whenever such an event happens, the corresponding method on this class will be called. Note that the user code always runs within the Worker’s main thread.
To implement a plugin:
- inherit from this class
- override some of its methods
- register the plugin using :meth:
Client.register_plugin<distributed.Client.register_plugin>.
The idempotent attribute is used to control whether or not the plugin should be ignored upon registration if a worker plugin with the same name already exists. If True, the plugin is ignored, otherwise the existing plugin is replaced. Defaults to False.*
Try it out
Create a cluster and run a few jobs.
Authenticate & Initialize Earth Engine
Get credentials and the GCP project ID, authenticating if necessary.
Start Dask Cluster
Start up a Earth Engine enabled cluster. This may take a few minutes to complete.
cluster = ClusterGEE(
name='test-class-cluster',
n_workers=2,
worker_cpu=8,
region='us-central1',
)Google Application Default Credentials have been written to a file on your Coiled VM(s).
These credentials will potentially be valid until explicitly revoked by running
gcloud auth application-default revoke
Retrieve a client for the cluster, and display it.
client = cluster.get_client()
clientClient
Client-b3af9aca-1a13-11ef-9cc9-fe11494405b6
| Connection method: Cluster object | Cluster type: __main__.ClusterGEE |
| Dashboard: https://cluster-ufyqp.dask.host/FqddnuVpTbRxtrlw/status |
Cluster Info
Cluster Info
ClusterGEE
test-class-cluster
| Dashboard: https://cluster-ufyqp.dask.host/FqddnuVpTbRxtrlw/status | Workers: 2 |
| Total threads: 16 | Total memory: 61.16 GiB |
Scheduler Info
Scheduler
Scheduler-5a28184a-b197-47fe-ad28-da85fb409c9a
| Comm: tls://10.2.0.13:8786 | Workers: 2 |
| Dashboard: http://10.2.0.13:8787/status | Total threads: 16 |
| Started: 12 minutes ago | Total memory: 61.16 GiB |
Workers
Workers
Worker: test-class-cluster-worker-05c91bd282
Worker: test-class-cluster-worker-05c91bd282
| Comm: tls://10.2.0.12:33737 | Total threads: 8 |
| Dashboard: http://10.2.0.12:8787/status | Memory: 30.58 GiB |
| Nanny: tls://10.2.0.12:39245 | |
| Local directory: /scratch/dask-scratch-space/worker-qv0i1fmx | |
Worker: test-class-cluster-worker-92d9293f4a
Worker: test-class-cluster-worker-92d9293f4a
| Comm: tls://10.2.0.11:40289 | Total threads: 8 |
| Dashboard: http://10.2.0.11:8787/status | Memory: 30.58 GiB |
| Nanny: tls://10.2.0.11:34949 | |
| Local directory: /scratch/dask-scratch-space/worker-o47xuth5 | |