astroquery icon indicating copy to clipboard operation
astroquery copied to clipboard

Questions about tracking upload jobs using using Gaia TAP+

Open javierggt opened this issue 2 years ago • 4 comments

I am running a code that is equivalent to the one in the docs (adding the job argument missing in the docs), and I have two questions.

This is the code:

from astroquery.gaia import Gaia

Gaia.login()

j1 = Gaia.launch_job_async(
    "select top 10 * from gaiadr3.gaia_source",
    name='test',
    background=False
)
job = Gaia.upload_table_from_job(job=j1)

The call to upload_table_from_job returns immediately, but the return value is None (whereas from the docs I assumed it would return something). The upload in my actual application takes a while, so I want my script to wait until it is uploaded, but I do not know how to have the script wait. One workaround I thought of is to wait until the table exists.

The questions are:

  • How do you retrieve the upload job? It is not returned by upload_table_from_job
  • The jobs listed by Gaia.list_async_jobs never have the name set, so I can't easily identify them, and wonder if I'm missing something. Is there a way to have the job names I see in the Gaia archive web page show up in the tap.model.job.Job?

javierggt avatar Jan 16 '24 15:01 javierggt

Dear @javierggt, in the gaia help page https://www.cosmos.esa.int/web/gaia-users/archive/use-cases#ClusterAnalysisPythonTutorial you can see that right after calling the function launch_job_async you can use the method results = job.get_results().

The documentation of this function says:

This method will block if the job is asynchronous and the job has not finished yet.

cosmoJFH avatar Jan 16 '24 18:01 cosmoJFH

Hi Cosmo, thanks for the answer, but I think that does not answer my question. I do not want to get the results, I want to upload them to a table so I can use them later.

My question is motivated by wanting my script to know when uploading finished so I can launch a query to use the table, and in general to know when jobs finished without having to check the web page myself.

javierggt avatar Jan 16 '24 18:01 javierggt

I think that the only way to know that your table has been created in the system is at the time a message like this is printed

INFO: Created table 't1705434281894O' from job: '1705434281894O'.

I think that the execution of the function upload_table_from_job is blocked till the task has been completed, isn't it?

cosmoJFH avatar Jan 16 '24 19:01 cosmoJFH

I think that the execution of the function upload_table_from_job is blocked till the task has been completed, isn't it?

No, it isn't.

javierggt avatar Jan 16 '24 20:01 javierggt