Esempio n. 1
0
function big_scenario()
{
    $pp = array();
    for ($i = 0; $i < 1; $i++) {
        $p = new PROJECT();
        $p->name = "C_{$i}";
        $p->resource_share = 100;
        $p->has_cpu = true;
        $p->cpu_ncpus = 1;
        $p->cpu_flops = 1000000000.0;
        $p->cpu_job_size = 1000000000000.0;
        $p->cpu_latency = 864000;
        $pp[] = $p;
    }
    for ($i = 0; $i < 1; $i++) {
        $p = new PROJECT();
        $p->name = "G_{$i}";
        $p->resource_share = 100;
        $p->has_gpu = true;
        $p->gpu_ncpus = 1;
        $p->gpu_flops = 10000000000.0;
        $p->gpu_job_size = 10000000000000.0;
        $p->gpu_latency = 864000;
        $pp[] = $p;
    }
    for ($i = 0; $i < 1; $i++) {
        $p = new PROJECT();
        $p->name = "CG_{$i}";
        $p->resource_share = 100;
        $p->has_gpu = true;
        $p->gpu_ncpus = 1;
        $p->gpu_flops = 1000000000.0;
        $p->gpu_job_size = 10000000000000.0;
        $p->gpu_latency = 864000;
        $p->has_cpu = true;
        $p->cpu_ncpus = 1;
        $p->cpu_flops = 1000000000.0;
        $p->cpu_job_size = 10000000000000.0;
        $p->cpu_latency = 864000;
        $pp[] = $p;
    }
    write_state($pp);
}
function save_access_token($access_token_info, $state)
{
    if (!isset($access_token_info['oauth_token']) || !isset($access_token_info['oauth_token_secret'])) {
        //Something went wrong with the access token request and we didn't get the information we need
        throw new Exception("OAuth access token did not contain expected information");
    }
    //we got the access token, so save it for future use
    $state['oauthState'] = 2;
    $state['access_token_info'] = $access_token_info;
    write_state($state);
    //save the access token for all subsequent resquests, in Zotero's case the token and secret are just the same Zotero API key
}