3
const task = ee.batch.Export.image.toCloudStorage({
      //task description
  });

  task.start(() => {
    console.log("Task started: " + task.id)
  }, (error) => {
    console.log("Error: " + error);
  });

When I run the above code, the task id that is logged to the console has the form of a uuid, e.g. Task started: 45cb84eb-c9fc-4887-9016-91a4c9fdfacb, whereas if I list the operations using ee.data.listOperations(), the taskid is in a completely different format e.g. TLWZI4LX3SXU7LPMAVEZNMOG.

When I use ee.data.getOperation(task.id), I get an error message saying that there is no task with that id, but when I pass the id listed in the ee.data.listOperations() array, it works.

Is there any way to get the correct task id from the task object itself?

1 Answer 1

0

You seem to have some weird mix of Javascript and Python in your syntax, but the ID with dashes is a temporary ID before the server has assigned a real one. You have to call task.status() to get the real ID.

1
  • Could you explain what the weird mix is? What would I need to change to make this snippet more javascript-y? When I call task.status(), I get an error message saying that task.status is not a function (and task.status is undefined), could you explain where I am supposed to call task.status()?
    – robaza
    Feb 3 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.