当查询从在线资源下载数据时,我正在尝试实现一些线程:
from random import random
import threading
import time
from astroquery.utils.tap.core import Tap
download_finished = threading.Event()
def background_download():
gaiaURL = "http://gea.esac.esa.int/tap-server/tap"
query2 = "SELECT * FROM gaiadr2.gaia_source AS gaia WHERE gaia.frame_rotator_object_type = 2"
gaia = Tap(url=gaiaURL)
job2 = gaia.launch_job_async(query2, name=None, output_file="type2.vot",
output_format="votable", verbose=False,
dump_to_file=True, background=False,
upload_resource=None, upload_table_name=None)
download_finished.set()
def main():
thread = threading.Thread(target=background_download)
thread.start()
download_finished.wait()
print('Download Complete')
if __name__ == '__main__':
main()
我有两个问题
更重要的是