我正在使用 celery 开发软件升级系统。我有一个我正在努力干净地实施的用例。以下是我的工作:
device_software_updates(device_id)
returns a list of software updates that need to be installed on a device
已安装的设备软件(设备 ID)
returns the software modules that are currently installed on a device
latest_device_software(device_id)
returns the latest software versions available for a device
软件更新(已安装软件、最新软件)
returns the latest software modules that are not installed
在纯 python 中,device_software_updates 的实现可能看起来像
def device_software_updates(device_id):
return software_updates(installed_device_software(device_id),
latest_device_software(device_id))
在 Celery 3.0 中实现这一点的最干净的方法是什么?我想使用组做一些事情。我当前的实现如下所示:
def device_software_updates(device_id):
return (
group(installed_device_software.s(device_id),
latest_device_software.s(device_id)) |
software_updates.s()
)()
不幸的是,这意味着 software_updates 的 argspecsoftware_updates(arg_list)
并不理想。