/home/finance/.conda/envs/py311/lib/python3.11/site-packages/distributed/node.py:187: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 46573 instead
warnings.warn(
2025-09-08 23:14:11,403 - distributed.protocol.pickle - ERROR - Failed to serialize <function train_model at 0x7f454c4619e0>.
Traceback (most recent call last):
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/distributed/protocol/pickle.py", line 73, in dumps
result = cloudpickle.dumps(x, **dump_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py", line 1537, in dumps
cp.dump(obj)
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py", line 1303, in dump
return super().dump(obj)
^^^^^^^^^^^^^^^^^
TypeError: cannot pickle '_asyncio.Task' object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/distributed/protocol/pickle.py", line 77, in dumps
result = cloudpickle.dumps(x, **dump_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py", line 1537, in dumps
cp.dump(obj)
File "/home/finance/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py", line 1303, in dump
return super().dump(obj)
^^^^^^^^^^^^^^^^^
TypeError: cannot pickle '_asyncio.Task' object
Dashboard: http://127.0.0.1:46573/status
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/protocol/pickle.py:73, in dumps(x, buffer_callback, protocol)
72 buffers.clear()
---> 73 result = cloudpickle.dumps(x, **dump_kwargs)
74 except Exception:
File ~/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py:1537, in dumps(obj, protocol, buffer_callback)
1536 cp = Pickler(file, protocol=protocol, buffer_callback=buffer_callback)
-> 1537 cp.dump(obj)
1538 return file.getvalue()
File ~/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py:1303, in Pickler.dump(self, obj)
1302 try:
-> 1303 return super().dump(obj)
1304 except RuntimeError as e:
TypeError: cannot pickle '_asyncio.Task' object
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[17], line 49
45 return future, start
48 # 启动异步训练
---> 49 future, start_time = client.run(train_model)
51 # 监控任务状态
52 while not future.done():
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/client.py:3188, in Client.run(self, function, workers, wait, nanny, on_error, *args, **kwargs)
3105 def run(
3106 self,
3107 function,
(...) 3113 **kwargs,
3114 ):
3115 """
3116 Run a function on all workers outside of task scheduling system
3117
(...) 3186 >>> c.run(print_state, wait=False) # doctest: +SKIP
3187 """
-> 3188 return self.sync(
3189 self._run,
3190 function,
3191 *args,
3192 workers=workers,
3193 wait=wait,
3194 nanny=nanny,
3195 on_error=on_error,
3196 **kwargs,
3197 )
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/utils.py:376, in SyncMethodMixin.sync(self, func, asynchronous, callback_timeout, *args, **kwargs)
374 return future
375 else:
--> 376 return sync(
377 self.loop, func, *args, callback_timeout=callback_timeout, **kwargs
378 )
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/utils.py:452, in sync(loop, func, callback_timeout, *args, **kwargs)
449 wait(10)
451 if error is not None:
--> 452 raise error
453 else:
454 return result
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/utils.py:426, in sync.<locals>.f()
424 awaitable = wait_for(awaitable, timeout)
425 future = asyncio.ensure_future(awaitable)
--> 426 result = yield future
427 except Exception as exception:
428 error = exception
File ~/.conda/envs/py311/lib/python3.11/site-packages/tornado/gen.py:769, in Runner.run(self)
767 try:
768 try:
--> 769 value = future.result()
770 except Exception as e:
771 # Save the exception for later. It's important that
772 # gen.throw() not be called inside this try/except block
773 # because that makes sys.exc_info behave unexpectedly.
774 exc: Optional[Exception] = e
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/client.py:3068, in Client._run(self, function, nanny, workers, wait, on_error, *args, **kwargs)
3055 async def _run(
3056 self,
3057 function,
(...) 3063 **kwargs,
3064 ):
3065 responses = await self.scheduler.broadcast(
3066 msg=dict(
3067 op="run",
-> 3068 function=dumps(function),
3069 args=dumps(args),
3070 wait=wait,
3071 kwargs=dumps(kwargs),
3072 ),
3073 workers=workers,
3074 nanny=nanny,
3075 on_error="return_pickle",
3076 )
3077 results = {}
3078 for key, resp in responses.items():
File ~/.conda/envs/py311/lib/python3.11/site-packages/distributed/protocol/pickle.py:77, in dumps(x, buffer_callback, protocol)
75 try:
76 buffers.clear()
---> 77 result = cloudpickle.dumps(x, **dump_kwargs)
78 except Exception:
79 logger.exception("Failed to serialize %s.", x)
File ~/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py:1537, in dumps(obj, protocol, buffer_callback)
1535 with io.BytesIO() as file:
1536 cp = Pickler(file, protocol=protocol, buffer_callback=buffer_callback)
-> 1537 cp.dump(obj)
1538 return file.getvalue()
File ~/.conda/envs/py311/lib/python3.11/site-packages/cloudpickle/cloudpickle.py:1303, in Pickler.dump(self, obj)
1301 def dump(self, obj):
1302 try:
-> 1303 return super().dump(obj)
1304 except RuntimeError as e:
1305 if len(e.args) > 0 and "recursion" in e.args[0]:
TypeError: cannot pickle '_asyncio.Task' object
最新发布