Let's say that my (asyncio) workflow is like this:
- A = aiohttp.get(url_a) (with n retries and timeout of each retry)
- B = aiohttp.get(url_b) (with n retries and timeout of each retry)
- if I got A & B -> save to the database
- if I got A but not B -> impute B and save to the database
- if I got B but not A -> impute A and save to the database
- if I haven't got A nor B -> impute A, impute B, save to the database
- aiohttp.post(url_x) (A, B)
Basically, I am trying to get A and B, but I could end in 4 different situations: get A and B, get A but not B, get B but not A and cannot get anything. Anyway, after timeout, I must know what I have got and continue with imputing missing values (if any) and saving to the database. When I say imputing, it is oversimplified. Actually, I need some kind of branching, checking inputs and choosing branch (something like if). After the record is successfully saved to the database, A and B should be posted to url_x.
Is such workflow an use case for (py)transitions state machine? If so, is there any example that is a bit alike the scenario I have just described? As a novice to the state machine concept, I don't even know what states are here and what are transitions.