Deserialize result from tuple.
(r, app=None)
| 1071 | |
| 1072 | |
| 1073 | def result_from_tuple(r, app=None): |
| 1074 | """Deserialize result from tuple.""" |
| 1075 | # earlier backends may just pickle, so check if |
| 1076 | # result is already prepared. |
| 1077 | app = app_or_default(app) |
| 1078 | Result = app.AsyncResult |
| 1079 | if not isinstance(r, ResultBase): |
| 1080 | res, nodes = r |
| 1081 | id, parent = res if isinstance(res, (list, tuple)) else (res, None) |
| 1082 | if parent: |
| 1083 | parent = result_from_tuple(parent, app) |
| 1084 | |
| 1085 | if nodes is not None: |
| 1086 | return app.GroupResult( |
| 1087 | id, [result_from_tuple(child, app) for child in nodes], |
| 1088 | parent=parent, |
| 1089 | ) |
| 1090 | |
| 1091 | return Result(id, parent=parent) |
| 1092 | return r |