Changes between Initial Version and Version 1 of BackendLogic


Ignore:
Timestamp:
Apr 25, 2007, 2:13:52 PM (18 years ago)
Author:
Nicolas
Comment:

Converted by an automatic script

Legend:

Unmodified
Added
Removed
Modified
  • BackendLogic

    v1 v1  
     1= Backend program logic =
     2
     3
     4=== Work generator ===
     5
     6
     7
     8{{{
     9    for each wu created
     10        wu.transition_time = now
     11}}}
     12
     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
     36
     37{{{
     38// gets run when either
     39// - a result becomes done (via timeout or client reply)
     40// - the WU error mask is set (e.g. by validator)
     41// - assimilation is finished
     42    for each WU with now > transition_time:
     43
     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
     49
     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
     55
     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
     62
     63        // Note: check on # of success results is done in validator
     64
     65        K = total # results
     66        if K > B
     67            error_mask |= too_many_total_results
     68
     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
     74
     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
     83
     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
     90
     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
     99
     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)
     104
     105        // if transitioner is way behind schedule,
     106        // don't repeatedly handle this WU
     107        transition_time = max(transition_time, now+delay_bound)
     108}}}
     109
     110=== Validator ===
     111
     112{{{
     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
     122                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
     138
     139        if need_to_handle_over_results:
     140            wu.transition_time = now
     141}}}
     142
     143=== Assimilator ===
     144
     145{{{
     146    for each WU with assimilate_state = READY
     147        call project-specific handler function
     148        wu.assimilate_state = done
     149        wu.transition_time = now
     150}}}