Ejemplo n.º 1
0
function sigSwitch($signo)
{
    global $RUNNING;
    switch ($signo) {
        case SIGTERM:
        case SIGINT:
            $RUNNING = false;
            break;
        case SIGHUP:
            $RUNNING = false;
            cleanShutDown();
            break;
        default:
            break;
    }
    $msg = str_pad(" CHILD " . getmypid() . " Caught Signal {$signo} ", 50, "-", STR_PAD_BOTH);
    _TimeStampMsg($msg);
}
Ejemplo n.º 2
0
    $tm_data['translation'] = $suggestion;
    $tm_data['tm_analysis_status'] = "DONE";
    $tm_data['warning'] = (int) $check->thereAreErrors();
    $tm_data['serialized_errors_list'] = $err_json;
    $tm_data['mt_qe'] = $mt_qe;
    $tm_data['pretranslate_100'] = $pretranslate_100;
    updateTMValues($tm_data);
    //unlock segment
    $amqHandlerSubscriber->ack($msg);
    _TimeStampMsg("--- (child {$my_pid}) : segment {$sid}-{$jid} acknowledged");
    //set memcache
    $amqHandlerSubscriber->incrementAnalyzedCount($pid, $eq_words, $standard_words);
    $amqHandlerSubscriber->decrementTotalForWaitingProjects($pid);
    $amqHandlerSubscriber->tryToCloseProject($pid, $my_pid);
} while ($RUNNING);
cleanShutDown();
//ANALYSIS FUNCTIONS
/**
 * @param string $tm_match_type
 * @param string $fast_match_type
 * @param Array  $equivalentWordMapping
 * @param bool   $publicTM
 *
 * @return string
 */
function getNewMatchType($tm_match_type, $fast_match_type, $equivalentWordMapping, $publicTM = false)
{
    // RATIO : modifico il valore solo se il nuovo match è strettamente migliore (in termini di percentuale pagata per parola) di quello corrente
    $tm_match_cat = "";
    $tm_rate_paid = 0;
    $fast_match_type = strtoupper($fast_match_type);