geeViz.taskManagerLib¶
Monitor and manage tasks programatically
geeViz.taskManagerLib facilitates the monitoring and deleting of GEE export tasks.
Functions
Cancel all tasks that are either ready or running. |
|
|
Cancel all tasks whose description contains the given identifier. |
Print all failed tasks and their run times. |
|
|
Create a CSV table of successful exports, including run time, EECU usage, and output size. |
|
Get a dictionary of tasks grouped by their state. |
|
Track completion of all jobs started within a time interval. |
|
Get list of tasks with specified name/description prefix. |
|
Get the current time as a formatted string. |
|
Get list of tasks started within a specified time interval. |
Track and print the number of ready and running tasks every 10 seconds, up to 1000 times. |
|
|
Track tasks for a specific credential or list of task IDs, printing status every 5 seconds. |
- geeViz.taskManagerLib.now()[source]¶
Get the current time as a formatted string.
- Returns:
Current time in “%Y-%m-%d %H:%M:%S” format.
- Return type:
str
Example
>>> now() '2025-06-01 12:34:56'
- geeViz.taskManagerLib.trackTasks()[source]¶
Track and print the number of ready and running tasks every 10 seconds, up to 1000 times.
Example
>>> trackTasks() 2 tasks ready 2025-06-01 12:34:56 1 tasks running 2025-06-01 12:34:56 Running names: ['ExportImage', '0:01:23'] ...
- geeViz.taskManagerLib.trackTasks2(credential_name=None, id_list=None, task_count=1)[source]¶
Track tasks for a specific credential or list of task IDs, printing status every 5 seconds.
- Parameters:
credential_name (str, optional) – Name of the credential to print.
id_list (list, optional) – List of task descriptions to filter.
task_count (int, optional) – Initial task count to start tracking.
Example
>>> trackTasks2(credential_name='user', id_list=['ExportImage'], task_count=1) user 1 tasks ready 2025-06-01 12:34:56 0 tasks running 2025-06-01 12:34:56 Running names: ...
- geeViz.taskManagerLib.getTasks(id_list=None)[source]¶
Get a dictionary of tasks grouped by their state.
- Parameters:
id_list (list, optional) – List of task descriptions to filter.
- Returns:
Dictionary with keys ‘ready’, ‘running’, ‘failed’, ‘completed’.
- Return type:
dict
Example
>>> getTasks() {'ready': ['ExportImage'], 'running': [], 'failed': [], 'completed': ['ExportTable']}
- geeViz.taskManagerLib.failedTasks()[source]¶
Print all failed tasks and their run times.
Example
>>> failedTasks() Failed names: {'id': 'ABCD', 'state': 'FAILED', ...} ...
- geeViz.taskManagerLib.batchCancel()[source]¶
Cancel all tasks that are either ready or running.
Example
>>> batchCancel() Cancelling: ExportImage READY: ExportImage ...
- geeViz.taskManagerLib.cancelByName(nameIdentifier)[source]¶
Cancel all tasks whose description contains the given identifier.
- Parameters:
nameIdentifier (str) – Substring to search for in task descriptions.
Example
>>> cancelByName('ExportImage') Cancelling ExportImage ...
- geeViz.taskManagerLib.timeTaskList(starttime, endtime)[source]¶
Get list of tasks started within a specified time interval.
- Parameters:
starttime (datetime) – UTC datetime object for interval start.
endtime (datetime) – UTC datetime object for interval end.
- Returns:
List of task dicts started within the interval.
- Return type:
list
Example
>>> from datetime import datetime, timedelta >>> start = datetime.utcnow() - timedelta(hours=1) >>> end = datetime.utcnow() >>> timeTaskList(start, end) [{'id': 'ABCD', ...}, ...]
- geeViz.taskManagerLib.jobCompletionTracker(starttime, endtime, check_interval)[source]¶
Track completion of all jobs started within a time interval.
- Parameters:
starttime (datetime) – UTC datetime object for interval start.
endtime (datetime) – UTC datetime object for interval end.
check_interval (int) – Seconds between status checks.
- Returns:
Lists of ready, running, completed, failed, cancelled, and all tasks.
- Return type:
list
Example
>>> from datetime import datetime, timedelta >>> start = datetime.utcnow() - timedelta(hours=1) >>> end = datetime.utcnow() >>> jobCompletionTracker(start, end, 10) ...
- geeViz.taskManagerLib.nameTaskList(nameIdentifier)[source]¶
Get list of tasks with specified name/description prefix.
- Parameters:
nameIdentifier (str) – Substring to search for in task descriptions.
- Returns:
List of matching task dicts.
- Return type:
list
Example
>>> nameTaskList('ExportImage') [{'id': 'ABCD', ...}, ...]
- geeViz.taskManagerLib.getEECUS(output_table_name, nameFind=None, overwrite=False)[source]¶
Create a CSV table of successful exports, including run time, EECU usage, and output size.
- Parameters:
output_table_name (str) – Path to output CSV file.
nameFind (str, optional) – Substring to filter task descriptions.
overwrite (bool, optional) – Overwrite existing file if True.
Example
>>> getEECUS('output.csv', nameFind='ExportImage', overwrite=True) Only output extension allowed is .csv. Changing extension to .csv ...