| 9 | | for each wu created |
|---|
| 10 | | wu.transition_time = now |
|---|
| | 13 | when send a result |
|---|
| | 14 | result.report_deadline = now + wu.delay_bound |
|---|
| | 15 | wu.transition_time = min(wu.transition_time, result.report_deadline) |
|---|
| | 16 | when receive a result |
|---|
| | 17 | if client error |
|---|
| | 18 | result.outcome = client_error |
|---|
| | 19 | result.validate_state = INVALID |
|---|
| | 20 | else |
|---|
| | 21 | result.outcome = success |
|---|
| | 22 | result.server_state = OVER |
|---|
| | 23 | wu.transition_time = now |
|---|
| | 24 | when a result falls off the bottom of infeasible queue |
|---|
| | 25 | result.server_state = OVER |
|---|
| | 26 | result.outcome = COULDNT_SEND |
|---|
| | 27 | wu.transition_time = now |
|---|
| 13 | | === scheduler === |
|---|
| 14 | | |
|---|
| 15 | | {{{ |
|---|
| 16 | | when send a result |
|---|
| 17 | | result.report_deadline = now + wu.delay_bound |
|---|
| 18 | | wu.transition_time = min(wu.transition_time, result.report_deadline) |
|---|
| 19 | | when receive a result |
|---|
| 20 | | if client error |
|---|
| 21 | | result.outcome = client_error |
|---|
| 22 | | result.validate_state = INVALID |
|---|
| 23 | | else |
|---|
| 24 | | result.outcome = success |
|---|
| 25 | | result.server_state = OVER |
|---|
| 26 | | wu.transition_time = now |
|---|
| 27 | | when a result falls off the bottom of infeasible queue |
|---|
| 28 | | result.server_state = OVER |
|---|
| 29 | | result.outcome = COULDNT_SEND |
|---|
| 30 | | wu.transition_time = now |
|---|
| 31 | | }}} |
|---|
| 32 | | |
|---|
| 33 | | === Transitioner === |
|---|
| 34 | | |
|---|
| 35 | | |
|---|
| | 30 | == Transitioner == |
|---|
| 56 | | // check for WU error conditions |
|---|
| 57 | | if any result has outcome couldnt_send |
|---|
| 58 | | error_mask |= couldnt_send |
|---|
| 59 | | K = # results with outcome = client_error |
|---|
| 60 | | if K > A |
|---|
| 61 | | error_mask |= too_many_error_results |
|---|
| | 51 | // check for WU error conditions |
|---|
| | 52 | if any result has outcome couldnt_send |
|---|
| | 53 | error_mask |= couldnt_send |
|---|
| | 54 | K = # results with outcome = client_error |
|---|
| | 55 | if K > A |
|---|
| | 56 | error_mask |= too_many_error_results |
|---|
| 75 | | // if WU errors, clean up unsent results |
|---|
| 76 | | // and trigger assimilation if needed |
|---|
| 77 | | if error_mask |
|---|
| 78 | | for all results server_state = unsent |
|---|
| 79 | | server_state = over |
|---|
| 80 | | outcome = didnt_need |
|---|
| 81 | | if wu.assimilate_state == init |
|---|
| 82 | | wu.assimilate_state = ready |
|---|
| | 70 | // if WU errors, clean up unsent results |
|---|
| | 71 | // and trigger assimilation if needed |
|---|
| | 72 | if error_mask |
|---|
| | 73 | for all results server_state = unsent |
|---|
| | 74 | server_state = over |
|---|
| | 75 | outcome = didnt_need |
|---|
| | 76 | if wu.assimilate_state == init |
|---|
| | 77 | wu.assimilate_state = ready |
|---|
| 84 | | // if WU is assimilated, trigger deletion of files |
|---|
| 85 | | if wu.assimilated_state = DONE |
|---|
| 86 | | // trigger input file deletion if needed |
|---|
| 87 | | if (all results are OVER and those that are outcome SUCCESS |
|---|
| 88 | | have validate_state != INIT) |
|---|
| 89 | | wu.file_delete_state = ready |
|---|
| | 79 | // if WU is assimilated, trigger deletion of files |
|---|
| | 80 | if wu.assimilated_state = DONE |
|---|
| | 81 | // trigger input file deletion if needed |
|---|
| | 82 | if (all results are OVER and those that are outcome SUCCESS |
|---|
| | 83 | have validate_state != INIT) |
|---|
| | 84 | wu.file_delete_state = ready |
|---|
| 91 | | // outputs of error results can be deleted immediately; |
|---|
| 92 | | // outputs of successful results can be deleted when validated |
|---|
| 93 | | for results of WU |
|---|
| 94 | | if canonical result and not all results OVER |
|---|
| 95 | | continue |
|---|
| 96 | | if outcome = CLIENT_ERROR or (SUCCESS and (VALID or INVALID)) |
|---|
| 97 | | if file_delete_state = INIT |
|---|
| 98 | | result.file_delete_state = READY |
|---|
| | 86 | // outputs of error results can be deleted immediately; |
|---|
| | 87 | // outputs of successful results can be deleted when validated |
|---|
| | 88 | for results of WU |
|---|
| | 89 | if canonical result and not all results OVER |
|---|
| | 90 | continue |
|---|
| | 91 | if outcome = CLIENT_ERROR or (SUCCESS and (VALID or INVALID)) |
|---|
| | 92 | if file_delete_state = INIT |
|---|
| | 93 | result.file_delete_state = READY |
|---|
| 100 | | // get next result timeout if any |
|---|
| 101 | | transition_time = MAX_INT |
|---|
| 102 | | for all results IN_PROGRESS |
|---|
| 103 | | transition_time = min(transition_time, result.report_deadline) |
|---|
| | 95 | // get next result timeout if any |
|---|
| | 96 | transition_time = MAX_INT |
|---|
| | 97 | for all results IN_PROGRESS |
|---|
| | 98 | transition_time = min(transition_time, result.report_deadline) |
|---|
| 113 | | for each WU w/ need_validate true |
|---|
| 114 | | if have canonical result |
|---|
| 115 | | for each result w/ validate_state INIT and outcome SUCCESS |
|---|
| 116 | | // possible that we've already deleted canonical output files |
|---|
| 117 | | if canonical_result.file_delete_state = DONE |
|---|
| 118 | | validate_state = INVALID |
|---|
| 119 | | else |
|---|
| 120 | | if matches canonical, grant credit |
|---|
| 121 | | validate_state = VALID or INVALID |
|---|
| | 108 | for each WU w/ need_validate true |
|---|
| | 109 | if have canonical result |
|---|
| | 110 | for each result w/ validate_state INIT and outcome SUCCESS |
|---|
| | 111 | // possible that we've already deleted canonical output files |
|---|
| | 112 | if canonical_result.file_delete_state = DONE |
|---|
| | 113 | validate_state = INVALID |
|---|
| | 114 | else |
|---|
| | 115 | if matches canonical, grant credit |
|---|
| | 116 | validate_state = VALID or INVALID |
|---|
| | 117 | need_to_handle_over_results = true |
|---|
| | 118 | else |
|---|
| | 119 | S = set of results w/ outcome SUCCESS |
|---|
| | 120 | if consensus(S) |
|---|
| | 121 | set canonical_result |
|---|
| | 122 | set success results as VALID or INVALID |
|---|
| | 123 | grant credit |
|---|
| | 124 | need_to_handle_over_results = true |
|---|
| | 125 | wu.assimilate_state = READY |
|---|
| | 126 | for all results server_state UNSENT |
|---|
| | 127 | server_state = OVER |
|---|
| | 128 | outcome = DIDNT_NEED |
|---|
| | 129 | else |
|---|
| | 130 | if # of successful results > C |
|---|
| | 131 | wu.error_mask |= too_many_success_result |
|---|