Changes between Version 1 and Version 2 of BackendLogic


Ignore:
Timestamp:
04/25/07 14:15:43 (11 years ago)
Author:
Nicolas
Comment:

Required manual changes to automatic conversion.

Legend:

Unmodified
Added
Removed
Modified
  • BackendLogic

    v1 v2  
    22
    33
    4 === Work generator ===
     4== Work generator ==
     5{{{
     6for each wu created
     7    wu.transition_time = now
     8}}}
    59
    6 
     10== Scheduler ==
    711
    812{{{
    9     for each wu created
    10         wu.transition_time = now
     13when send a result
     14    result.report_deadline = now + wu.delay_bound
     15    wu.transition_time = min(wu.transition_time, result.report_deadline)
     16when 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
     24when a result falls off the bottom of infeasible queue
     25    result.server_state = OVER
     26    result.outcome = COULDNT_SEND
     27    wu.transition_time = now
    1128}}}
    1229
    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 ==
    3631
    3732{{{
     
    4035// - the WU error mask is set (e.g. by validator)
    4136// - assimilation is finished
    42     for each WU with now > transition_time:
     37for each WU with now > transition_time:
    4338
    44         // check for timed-out results
    45         for each result of WU
    46             if result.server_state = in_progress and now > result.report_deadline
    47                 result.server_state = OVER
    48                 result.outcome = NO_REPLY
     39    // check for timed-out results
     40    for each result of WU
     41        if result.server_state = in_progress and now > result.report_deadline
     42            result.server_state = OVER
     43            result.outcome = NO_REPLY
    4944
    50         // trigger validation if needed
    51         K = # of SUCCESS results
    52         if K >= M
    53             if any result is server_state OVER, outcome SUCCESS, validate_state INIT
    54                 wu.need_validate = true
     45    // trigger validation if needed
     46    K = # of SUCCESS results
     47    if K >= M
     48        if any result is server_state OVER, outcome SUCCESS, validate_state INIT
     49            wu.need_validate = true
    5550
    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
    6257
    63         // Note: check on # of success results is done in validator
     58    // Note: check on # of success results is done in validator
    6459
    65         K = total # results
    66         if K > B
    67             error_mask |= too_many_total_results
     60    K = total # results
     61    if K > B
     62        error_mask |= too_many_total_results
    6863
    69         // if no WU errors, generate new results if needed
    70         if error_mask == 0
    71             K = # results w/ server_state = unsent or in_progress
    72             L = N - K
    73             generate L new results
     64    // if no WU errors, generate new results if needed
     65    if error_mask == 0
     66        K = # results w/ server_state = unsent or in_progress
     67        L = N - K
     68        generate L new results
    7469
    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
    8378
    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
    9085
    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
    9994
    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)
    10499
    105         // if transitioner is way behind schedule,
    106         // don't repeatedly handle this WU
    107         transition_time = max(transition_time, now+delay_bound)
     100    // if transitioner is way behind schedule,
     101    // don't repeatedly handle this WU
     102    transition_time = max(transition_time, now+delay_bound)
    108103}}}
    109104
    110 === Validator ===
     105== Validator ==
    111106
    112107{{{
    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
     108for 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
    122132                need_to_handle_over_results = true
    123         else
    124             S = set of results w/ outcome SUCCESS
    125             if consensus(S)
    126                 set canonical_result
    127                 set success results as VALID or INVALID
    128                 grant credit
    129                 need_to_handle_over_results = true
    130                 wu.assimilate_state = READY
    131                 for all results server_state UNSENT
    132                     server_state = OVER
    133                     outcome = DIDNT_NEED
    134             else
    135                 if # of successful results > C
    136                     wu.error_mask |= too_many_success_result
    137                     need_to_handle_over_results = true
    138133
    139         if need_to_handle_over_results:
    140             wu.transition_time = now
     134    if need_to_handle_over_results:
     135        wu.transition_time = now
    141136}}}
    142137
    143 === Assimilator ===
     138== Assimilator ==
    144139
    145140{{{
    146     for each WU with assimilate_state = READY
    147         call project-specific handler function
    148         wu.assimilate_state = done
    149         wu.transition_time = now
     141for each WU with assimilate_state = READY
     142    call project-specific handler function
     143    wu.assimilate_state = done
     144    wu.transition_time = now
    150145}}}