大佬, 我创建了2个任务,第一个负责下载,第二个负责处理;但是负责处理的任务依赖于第一个,而处理任务会有大量的IO,因此我设置了下载2个线程处理,而处理任务只开启了1个。于是在提交任务的函数中设置了获取下载的运行状态,要求回调结果,但是弹出下面的错误,简化代码如下:
from tasks import download_task, compress_task
def request(url, tempfn):
'''
url 为下载地址
tempfn 为下载的本地路径
'''
download_status = download_task.push(url)
if download_status.result:
compress_task.push(tempfn)
raceback (most recent call last):
File "/root/anaconda3/lib/python3.9/threading.py", line 930, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7f3b3c808af0>
└ <DummyProcess(Thread-8, started daemon 139891555944192)>
File "/root/anaconda3/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
│ └ <function Thread.run at 0x7f3b3c808820>
└ <DummyProcess(Thread-8, started daemon 139891555944192)>
File "/root/anaconda3/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
│ │ │ │ │ └ {}
│ │ │ │ └ <DummyProcess(Thread-8, started daemon 139891555944192)>
│ │ │ └ (<_queue.SimpleQueue object at 0x7f3b2179af40>, <_queue.SimpleQueue object at 0x7f3b2179aa40>, None, (), None, False)
│ │ └ <DummyProcess(Thread-8, started daemon 139891555944192)>
│ └ <function worker at 0x7f3b217c71f0>
└ <DummyProcess(Thread-8, started daemon 139891555944192)>
File "/root/anaconda3/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
│ │ └ {}
│ └ (('reanalysis-era5-pressure-levels', {'variable': 'geopotential', 'year': '2020', 'month': '4', 'format': 'netcdf', 'area': '...
└ <function only_request at 0x7f3b23864d30>
> File "/root/anaconda3/lib/python3.9/site-packages/era5/cli.py", line 111, in only_request
if downloas_status.result: # 为了阻塞线程
│ └ <property object at 0x7f3b24a51450>
└ <funboost.publishers.base_publisher.AsyncResult object at 0x7f3b2078e2b0>
File "/root/anaconda3/lib/python3.9/site-packages/funboost/publishers/base_publisher.py", line 68, in result
return self.get()
│ └ <function AsyncResult.get at 0x7f3b24a52280>
└ <funboost.publishers.base_publisher.AsyncResult object at 0x7f3b2078e2b0>
File "/root/anaconda3/lib/python3.9/site-packages/funboost/publishers/base_publisher.py", line 64, in get
raise HasNotAsyncResult
└ <class 'funboost.publishers.base_publisher.HasNotAsyncResult'>