Пример #1
0
global $transport;
use Airavata\API\Error\AiravataClientException;
use Airavata\API\Error\AiravataSystemException;
use Airavata\API\Error\ExperimentNotFoundException;
use Airavata\API\Error\InvalidRequestException;
use Airavata\Client\AiravataClientFactory;
use Airavata\Model\Workspace\Experiment\ExperimentState;
use Thrift\Exception\TTransportException;
use Thrift\Protocol\TBinaryProtocol;
use Thrift\Transport\TBufferedTransport;
use Thrift\Transport\TSocket;
use Airavata\API\AiravataClient;
if ($argc != 2) {
    echo 'Please provide the Experiment ID.' . "\n" . 'Usage: php cloneExperiment.php <experiment_ID>' . "\n";
} else {
    $cloneId = clone_experiment($argv[1]);
    $clone = get_experiment($cloneId);
    var_dump($clone);
    echo "Successfully created a clone with experiment_ID {$clone->experimentID} and experiment_name {$clone->name}" . "\n";
}
//var_dump($experiment);
$transport->close();
/**
 * Get the experiment with the given ID
 * @param $expId
 * @return null
 */
function get_experiment($expId)
{
    global $airavataclient;
    try {
    case 'SCHEDULED':
    case 'LAUNCHED':
    case 'EXECUTING':
        $cancelable = true;
        break;
    default:
        $cancelable = false;
        break;
}
if (isset($_POST['save'])) {
    $updatedExperiment = apply_changes_to_experiment($experiment);
    update_experiment($experiment->experimentID, $updatedExperiment);
} elseif (isset($_POST['launch'])) {
    launch_experiment($experiment->experimentID);
} elseif (isset($_POST['clone'])) {
    clone_experiment($experiment->experimentID);
} elseif (isset($_POST['cancel'])) {
    cancel_experiment($experiment->experimentID);
}
//$transport->close();
?>


<h1>
    Experiment Summary
    <small><a href="experiment_summary.php?expId=<?php 
echo $experiment->experimentID;
?>
"
              title="Refresh"><span class="glyphicon glyphicon-refresh"></span></a></small>
</h1>