def start(self):
subtasks = [self.driver.pre_upgrade()]
for project in SCENARIO:
for service in project.services:
service, hosts = dbapi.get_service_with_hosts(
service.name,
self._upgrade['cluster_id'])
# SCENARIO may contain services that are not deployed in
# current setup. Hence, attempt to return its instance
# and hosts will return None, and we have no choice but
# ignore it and continue.
if service:
subtasks.append(self.driver.start(service, hosts))
# Execute gathered tasks one-by-one preserving order. Please note,
# that it doesn't mean there can't be parallel execution since driver
# may return a Celery group of tasks instead, and in that case the
# group will be executed instead. The idea is to run one-by-one what
# was returned by driver regardless whether it's a task, a group or
# a chain.
supertask = celery.chain(*subtasks)
supertask.apply_async()
评论列表
文章目录