Skip to content

Commit

Permalink
updated v1.0.1
Browse files Browse the repository at this point in the history
- Updated pending/ready tasks as they are called in tasklist
- Fixed task cancellation options
  • Loading branch information
samapriya committed Oct 1, 2023
1 parent 4ed7fe7 commit 76f116e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

#### v1.0.1
- Updated pending/ready tasks as they are called in tasklist
- Fixed task cancellation options

### v1.0.0
- Gives better parsing of tasking info
- Search by task ID now
Expand Down
2 changes: 1 addition & 1 deletion geeadd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = "Samapriya Roy"
__email__ = "samapriya.roy@gmail.com"
__version__ = "1.0.0"
__version__ = "1.0.1"
15 changes: 6 additions & 9 deletions geeadd/geeadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def cancel_tasks(tasks):
task
for task in ee.data.listOperations()
if task["metadata"]["state"] == "RUNNING"
or task["metadata"]["state"] == "PENDING"
or task["metadata"]["state"] == "READY"
]
if len(all_tasks) > 0:
for task in all_tasks:
Expand Down Expand Up @@ -179,7 +179,7 @@ def cancel_tasks(tasks):
ready_tasks = [
task
for task in ee.data.listOperations()
if task["metadata"]["state"] == "PENDING"
if task["metadata"]["state"] == "READY"
]
if len(ready_tasks) > 0:
for task in ready_tasks:
Expand All @@ -199,7 +199,7 @@ def cancel_tasks(tasks):
)
if (
get_status["metadata"]["state"] == "RUNNING"
or get_status["metadata"]["state"] == "PENDING"
or get_status["metadata"]["state"] == "READY"
):
ee.data.cancelTask(task["id"])
print(
Expand All @@ -214,9 +214,6 @@ def cancel_tasks(tasks):
def delete(ids):
try:
print("Recursively deleting path: {}".format(ids))
# subprocess.call(
# "earthengine rm -r {}".format(ids), shell=True, stdout=subprocess.PIPE
# )
process_output = subprocess.run(["earthengine", "rm", "-r", "{}".format(ids)], capture_output=True, text=True)
print("output from commandline: {}".format(process_output.stdout))
except Exception as e:
Expand Down Expand Up @@ -334,7 +331,7 @@ def tasks(state,id):
for status in statuses:
st.append(status["state"])
print(f"Tasks Running: {st.count('RUNNING')}")
print(f"Tasks Pending: {st.count('PENDING')}")
print(f"Tasks Pending: {st.count('READY')}")
print(f"Tasks Completed: {st.count('COMPLETED')+st.count('SUCCEEDED')}")
print(f"Tasks Failed: {st.count('FAILED')}")
print(f"Tasks Cancelled: {st.count('CANCELLED') + st.count('CANCELLING')}")
Expand Down Expand Up @@ -703,12 +700,12 @@ def main(args=None):

parser_tasks = subparsers.add_parser(
"tasks",
help="Queries current task status [completed,running,pending,failed,cancelled]",
help="Queries current task status [completed,running,ready,failed,cancelled]",
)
optional_named = parser_tasks.add_argument_group("Optional named arguments")
optional_named.add_argument(
"--state",
help="Query by state type COMPLETED|PENDING|RUNNING|FAILED",
help="Query by state type COMPLETED|READY|RUNNING|FAILED",
)
optional_named.add_argument(
"--id",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="geeadd",
version="1.0.0",
version="1.0.1",
packages=["geeadd"],
data_files=[("", ["LICENSE"])],
url="https://github.com/samapriya/gee_asset_manager_addon",
Expand Down

0 comments on commit 76f116e

Please sign in to comment.