本文整理汇总了PHP中pts_client::remove_saved_result_file方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::remove_saved_result_file方法的具体用法?PHP pts_client::remove_saved_result_file怎么用?PHP pts_client::remove_saved_result_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::remove_saved_result_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_test_result
//.........这里部分代码省略.........
if ($object instanceof pts_result_file) {
$result_file =& $object;
$local_file_name = $result_file->get_identifier();
$results_identifier = null;
}
}
// Ensure the results can be shared
if (self::result_upload_supported($result_file) == false) {
return false;
}
if (pts_network::internet_support_available() == false) {
echo PHP_EOL . 'No network support available.' . PHP_EOL;
return false;
}
$composite_xml = $result_file->getRawXml();
$system_log_dir = PTS_SAVE_RESULTS_PATH . $result_file->get_identifier() . '/system-logs/';
$upload_system_logs = false;
if (is_dir($system_log_dir)) {
if (pts_config::read_bool_config('PhoronixTestSuite/Options/OpenBenchmarking/AlwaysUploadSystemLogs', 'FALSE')) {
$upload_system_logs = true;
} else {
if (isset(self::$client_settings['UploadSystemLogsByDefault'])) {
$upload_system_logs = self::$client_settings['UploadSystemLogsByDefault'];
} else {
if (is_dir($system_log_dir)) {
$upload_system_logs = pts_user_io::prompt_bool_input('Would you like to attach the system logs (lspci, dmesg, lsusb, etc) to the test result', true, 'UPLOAD_SYSTEM_LOGS');
}
}
}
}
$system_logs = null;
$system_logs_hash = null;
if ($upload_system_logs) {
$is_valid_log = true;
$finfo = function_exists('finfo_open') ? finfo_open(FILEINFO_MIME_TYPE) : false;
foreach (pts_file_io::glob($system_log_dir . '*') as $log_dir) {
if ($is_valid_log == false || !is_dir($log_dir)) {
$is_valid_log = false;
break;
}
foreach (pts_file_io::glob($log_dir . '/*') as $log_file) {
if (!is_file($log_file)) {
$is_valid_log = false;
break;
}
if ($finfo && substr(finfo_file($finfo, $log_file), 0, 5) != 'text/') {
$is_valid_log = false;
break;
}
}
}
if ($is_valid_log) {
$system_logs_zip = pts_client::create_temporary_file('.zip');
pts_compression::zip_archive_create($system_logs_zip, $system_log_dir);
if (filesize($system_logs_zip) < 2097152) {
// If it's over 2MB, probably too big
$system_logs = base64_encode(file_get_contents($system_logs_zip));
$system_logs_hash = sha1($system_logs);
} else {
trigger_error('The systems log attachment is too large to upload to OpenBenchmarking.org.', E_USER_WARNING);
}
unlink($system_logs_zip);
}
}
$composite_xml_hash = sha1($composite_xml);
$composite_xml_type = 'composite_xml';
// Compress the result file XML if it's big
if (isset($composite_xml[50000]) && function_exists('gzdeflate')) {
$composite_xml_gz = gzdeflate($composite_xml);
if ($composite_xml_gz != false) {
$composite_xml = $composite_xml_gz;
$composite_xml_type = 'composite_xml_gz';
}
}
$to_post = array($composite_xml_type => base64_encode($composite_xml), 'composite_xml_hash' => $composite_xml_hash, 'local_file_name' => $local_file_name, 'this_results_identifier' => $results_identifier, 'system_logs_zip' => $system_logs, 'system_logs_hash' => $system_logs_hash);
if (isset(self::$client_settings['ResultUploadsDefaultDisplayStatus']) && is_numeric(self::$client_settings['ResultUploadsDefaultDisplayStatus'])) {
$to_post['display_status'] = self::$client_settings['ResultUploadsDefaultDisplayStatus'];
}
$json_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_result', $to_post);
$json_response = json_decode($json_response, true);
if (!is_array($json_response)) {
trigger_error('Unhandled Exception', E_USER_ERROR);
return false;
}
if (isset($json_response['openbenchmarking']['upload']['error'])) {
trigger_error($json_response['openbenchmarking']['upload']['error'], E_USER_ERROR);
}
if (isset($json_response['openbenchmarking']['upload']['url'])) {
echo PHP_EOL . 'Results Uploaded To: ' . $json_response['openbenchmarking']['upload']['url'] . PHP_EOL;
pts_module_manager::module_process('__event_openbenchmarking_upload', $json_response);
}
//$json['openbenchmarking']['upload']['id']
if (isset(self::$client_settings['RemoveLocalResultsOnUpload']) && self::$client_settings['RemoveLocalResultsOnUpload'] && $local_file_name != null) {
pts_client::remove_saved_result_file($local_file_name);
}
if ($return_json_data) {
return isset($json_response['openbenchmarking']['upload']) ? $json_response['openbenchmarking']['upload'] : false;
}
return isset($json_response['openbenchmarking']['upload']['url']) ? $json_response['openbenchmarking']['upload']['url'] : false;
}
示例2: run
public static function run($r)
{
pts_client::$display->generic_heading('Random Test Execution');
$allow_new_tests_to_be_installed = pts_user_io::prompt_bool_input('Allow new tests to be installed', true);
$allow_new_dependencies_to_be_installed = $allow_new_tests_to_be_installed ? pts_user_io::prompt_bool_input('Allow new test external dependencies to be installed', false) : false;
$limit_test_subsystem = pts_user_io::prompt_bool_input('Limit tests to a given subsystem', false);
$limit_test_subsystem = $limit_test_subsystem ? pts_user_io::prompt_text_menu('Select subsystem(s) to test', pts_types::subsystem_targets(), true) : false;
$upload_to_openbenchmarking = pts_user_io::prompt_bool_input('Auto-upload test results to OpenBenchmarking.org', true);
while (1) {
$to_test = array();
if ($limit_test_subsystem) {
foreach (explode(',', $limit_test_subsystem) as $test_type) {
$tests = pts_openbenchmarking_client::popular_tests(-1, $test_type);
$to_test = array_merge($to_test, $tests);
}
if (empty($to_test)) {
pts_client::$display->generic_sub_heading('No tests could be found to run.');
return false;
}
shuffle($to_test);
$to_test = array_slice($to_test, 0, rand(1, 12));
} else {
if (rand(1, 6) == 2) {
$ob_ids = pts_openbenchmarking_client::popular_openbenchmarking_results();
$ob_type = rand(0, 1) == 1 ? 'recent_popular_results' : 'recent_results';
if (isset($ob_ids[$ob_type]) && !empty($ob_ids[$ob_type])) {
shuffle($ob_ids[$ob_type]);
$to_test = array(array_pop($ob_ids[$ob_type]));
}
}
}
if (empty($to_test)) {
// Randomly pick some installed tests
$installed_tests = pts_tests::installed_tests();
if ($installed_tests > 3) {
shuffle($installed_tests);
$to_test = array_slice($installed_tests, 0, rand(1, 8));
}
if (!isset($to_test[2]) && $allow_new_tests_to_be_installed) {
$available_tests = pts_openbenchmarking::available_tests();
shuffle($available_tests);
$to_test = array_merge($to_test, array_slice($available_tests, 0, rand(1, 10)));
}
}
if (empty($to_test)) {
pts_client::$display->generic_sub_heading('No tests could be found to run.');
return false;
}
echo PHP_EOL;
pts_client::$display->generic_sub_heading('Tests To Run: ' . implode(', ', $to_test));
// QUERY FROM OB
$random_titles = array(phodevi::read_property('cpu', 'model') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Performance', phodevi::read_property('cpu', 'model') . ' Performance', phodevi::read_property('cpu', 'model') . ' + ' . phodevi::read_property('gpu', 'model') . ' + ' . phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('motherboard', 'identifier') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('cpu', 'model') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('system', 'kernel') . ' + ' . phodevi::read_property('system', 'operating-system') . ' Tests');
shuffle($random_titles);
$title = array_pop($random_titles);
if ($limit_test_subsystem) {
$subsystems_to_test = explode(',', $limit_test_subsystem);
$subsystems_to_avoid = array_diff(pts_types::subsystem_targets(), $subsystems_to_test);
pts_client::pts_set_environment_variable('SKIP_TESTING_SUBSYSTEMS', implode(',', $subsystems_to_avoid));
}
if ($allow_new_tests_to_be_installed) {
pts_test_installer::standard_install($to_test, false, true, $allow_new_dependencies_to_be_installed);
}
$batch_mode_settings = array('UploadResults' => false, 'SaveResults' => true, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false);
if ($upload_to_openbenchmarking) {
$batch_mode_settings['UploadResults'] = true;
pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true);
}
pts_test_run_manager::set_batch_mode($batch_mode_settings);
$test_run_manager = new pts_test_run_manager($batch_mode_settings, 2);
if ($test_run_manager->initial_checks($to_test) != false) {
if ($test_run_manager->load_tests_to_run($to_test)) {
// SETUP
$test_run_manager->auto_save_results($title, null, 'Various open-source benchmarks by the ' . pts_core::program_title(true) . '.', true);
$test_run_manager->auto_generate_results_identifier();
echo PHP_EOL;
pts_client::$display->generic_sub_heading('Result File: ' . $test_run_manager->get_file_name());
pts_client::$display->generic_sub_heading('Result Identifier: ' . $test_run_manager->get_results_identifier());
// BENCHMARK
$test_run_manager->pre_execution_process();
$test_run_manager->call_test_runs();
$test_run_manager->post_execution_process();
pts_client::remove_saved_result_file($test_run_manager->get_file_name());
}
}
echo PHP_EOL;
sleep(30);
}
}
示例3: user_system_process
public static function user_system_process()
{
$last_communication_minute = date('i');
$communication_attempts = 0;
static $current_hw = null;
static $current_sw = null;
if (define('PHOROMATIC_START', true)) {
echo PHP_EOL . 'Registering Status With Phoromatic Server @ ' . date('H:i:s') . PHP_EOL;
$times_tried = 0;
do {
if ($times_tried > 0) {
echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
sleep(60);
}
$update_sd = phoromatic::update_system_details();
$times_tried++;
} while (!$update_sd && $times_tried < 5);
if (!$update_sd) {
echo 'Server connection still failed. Exiting...' . PHP_EOL;
return false;
}
$current_hw = phodevi::system_hardware(true);
$current_sw = phodevi::system_software(true);
echo PHP_EOL . 'Idling 30 seconds for system to settle...' . PHP_EOL;
sleep(30);
}
do {
$exit_loop = false;
echo PHP_EOL . 'Checking Status From Phoromatic Server @ ' . date('H:i:s');
if ($last_communication_minute == date('i') && $communication_attempts > 2) {
// Something is wrong, Phoromatic shouldn't be communicating with server more than three times a minute
$response = M_PHOROMATIC_RESPONSE_IDLE;
} else {
$server_response = phoromatic::upload_to_remote_server(array('r' => 'status_check'));
$xml_parser = new nye_XmlReader($server_response);
$response = $xml_parser->getXMLValue(M_PHOROMATIC_GEN_RESPONSE);
if (date('i') != $last_communication_minute) {
$last_communication_minute = date('i');
$communication_attempts = 0;
}
$communication_attempts++;
}
echo ' [' . $response . ']' . PHP_EOL;
switch ($response) {
case M_PHOROMATIC_RESPONSE_RUN_TEST:
$test_flags = pts_c::auto_mode | pts_c::recovery_mode;
do {
$suite_identifier = 'phoromatic-' . rand(1000, 9999);
} while (is_file(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'));
file_put_contents(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml', $server_response);
$phoromatic_schedule_id = $xml_parser->getXMLValue(M_PHOROMATIC_ID);
$phoromatic_results_identifier = $xml_parser->getXMLValue(M_PHOROMATIC_SYS_NAME);
$phoromatic_trigger = $xml_parser->getXMLValue(M_PHOROMATIC_TRIGGER);
if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_RUN_INSTALL_COMMAND, M_PHOROMATIC_RESPONSE_TRUE))) {
phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_INSTALL), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
pts_client::set_test_flags($test_flags);
pts_test_installer::standard_install($suite_identifier);
}
phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_RUN), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
// Do the actual running
if (pts_test_run_manager::initial_checks($suite_identifier)) {
$test_run_manager = new pts_test_run_manager($test_flags);
// Load the tests to run
if ($test_run_manager->load_tests_to_run($suite_identifier)) {
if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_UPLOAD_TO_GLOBAL, 'FALSE'))) {
$test_run_manager->auto_upload_to_openbenchmarking();
}
// Save results?
$test_run_manager->auto_save_results(date('Y-m-d H:i:s'), $phoromatic_results_identifier, 'A Phoromatic run.');
// Run the actual tests
$test_run_manager->pre_execution_process();
$test_run_manager->call_test_runs();
$test_run_manager->post_execution_process();
// Upload to Phoromatic
pts_file_io::unlink(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml');
// Upload test results
if (is_file(PTS_SAVE_RESULTS_PATH . $save_identifier . '/composite.xml')) {
phoromatic::update_system_status('Uploading Test Results');
$times_tried = 0;
do {
if ($times_tried > 0) {
echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
sleep(60);
}
$uploaded_test_results = phoromatic::upload_test_results($save_identifier, $phoromatic_schedule_id, $phoromatic_results_identifier, $phoromatic_trigger);
$times_tried++;
} while ($uploaded_test_results == false && $times_tried < 5);
if ($uploaded_test_results == false) {
echo 'Server connection failed. Exiting...' . PHP_EOL;
return false;
}
if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_ARCHIVE_RESULTS_LOCALLY, M_PHOROMATIC_RESPONSE_TRUE)) == false) {
pts_client::remove_saved_result_file($save_identifier);
}
}
}
}
break;
case M_PHOROMATIC_RESPONSE_EXIT:
echo PHP_EOL . 'Phoromatic received a remote command to exit.' . PHP_EOL;
//.........这里部分代码省略.........
示例4: run_connection
//.........这里部分代码省略.........
phoromatic::update_system_status('Tests In Run Queue: ' . implode(', ', self::$test_run_manager->get_tests_to_run_identifiers()));
if (isset($json['phoromatic']['pre_run_set_context'])) {
phoromatic::set_user_context($json['phoromatic']['pre_run_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'PRE_RUN');
}
if (isset($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking']) && pts_strings::string_bool($json['phoromatic']['settings']['UploadResultsToOpenBenchmarking'])) {
self::$test_run_manager->auto_upload_to_openbenchmarking();
pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', pts_strings::string_bool($json['phoromatic']['settings']['UploadSystemLogs']));
}
// Save results?
// Run the actual tests
if (isset($env_vars['PTS_CONCURRENT_TEST_RUNS']) && $env_vars['PTS_CONCURRENT_TEST_RUNS'] > 1) {
$total_loop_time = isset($env_vars['TOTAL_LOOP_TIME']) ? $env_vars['TOTAL_LOOP_TIME'] : false;
pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION STARTED @ ' . date('Y-m-d H:i:s'));
pts_client::$pts_logger->log('CONCURRENT RUNS = ' . $env_vars['PTS_CONCURRENT_TEST_RUNS'] . ' TOTAL LOOP TIME = ' . $total_loop_time);
$r = self::$test_run_manager->multi_test_stress_run_execute($env_vars['PTS_CONCURRENT_TEST_RUNS'], $total_loop_time);
if ($r == false) {
return;
}
pts_client::$pts_logger->log('STRESS / MULTI-TEST EXECUTION ENDED @ ' . date('Y-m-d H:i:s'));
} else {
self::$test_run_manager->auto_save_results($phoromatic_save_identifier, $phoromatic_results_identifier, isset($json['phoromatic']['test_description']) ? $json['phoromatic']['test_description'] : 'A Phoromatic run.');
self::$test_run_manager->pre_execution_process();
self::$test_run_manager->call_test_runs();
}
phoromatic::update_system_status('Benchmarks Completed For: ' . $phoromatic_save_identifier);
self::$test_run_manager->post_execution_process();
$elapsed_benchmark_time = time() - $benchmark_timer;
// Handle uploading data to server
$result_file = new pts_result_file(self::$test_run_manager->get_file_name());
$upload_system_logs = pts_strings::string_bool($json['phoromatic']['settings']['UploadSystemLogs']);
$server_response = self::upload_test_result($result_file, $upload_system_logs, isset($json['phoromatic']['schedule_id']) ? $json['phoromatic']['schedule_id'] : null, $phoromatic_save_identifier, $json['phoromatic']['trigger_id'], $elapsed_benchmark_time, $benchmark_ticket_id);
//pts_client::$pts_logger->log('DEBUG RESPONSE MESSAGE: ' . $server_response);
if (!pts_strings::string_bool($json['phoromatic']['settings']['ArchiveResultsLocally'])) {
pts_client::remove_saved_result_file(self::$test_run_manager->get_file_name());
}
}
if (isset($json['phoromatic']['post_install_set_context'])) {
phoromatic::set_user_context($json['phoromatic']['post_install_set_context'], self::$p_trigger_id, self::$p_schedule_id, 'POST_RUN');
}
}
self::$p_schedule_id = null;
self::$is_running_as_phoromatic_node = false;
break;
case 'reboot':
echo PHP_EOL . 'Phoromatic received a remote command to reboot.' . PHP_EOL;
phoromatic::update_system_status('Attempting System Reboot');
if (pts_client::executable_in_path('reboot')) {
shell_exec('reboot');
sleep(5);
}
break;
case 'shutdown-if-supports-wake':
$supports_wol = false;
foreach (pts_network::get_network_wol() as $net_device) {
if (strpos($net_device, 'g') !== false) {
$supports_wol = true;
break;
}
}
if (!$supports_wol) {
break;
}
case 'shutdown':
if (isset($json['phoromatic']['client_update_script']) && !empty($json['phoromatic']['client_update_script'])) {
self::run_client_update_script($json['phoromatic']['client_update_script']);
sleep(10);
示例5: run
public static function run($r)
{
pts_client::remove_saved_result_file($r[0]);
echo PHP_EOL . $r[0] . ' was removed.' . PHP_EOL;
}