How to use phoromatic_server class

Best Phoronix-test-suite code snippet using phoromatic_server

pts_phoromatic_event_server.php

Source:pts_phoromatic_event_server.php Github

copy

Full Screen

...54 while(true)55 {56 $hour = date('G');57 $minute = date('i');58 phoromatic_server::prepare_database();59 if($is_first_run || $minute == 0)60 {61 if($is_first_run || $hour == 8)62 {63 pts_client::fork(array('pts_phoromatic_event_server', 'ob_cache_run'), null);64 }65 // Check for basic hung systems66 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, EstimatedTimeForTask, SystemID, AccountID, LastIP FROM phoromatic_systems WHERE State > 0 ORDER BY LastCommunication DESC');67 $result = $stmt ? $stmt->execute() : false;68 while($result && $row = $result->fetchArray())69 {70 $last_comm = strtotime($row['LastCommunication']);71 if($last_comm > (time() - 3600))72 continue; // if last comm time is less than an hour, still might be busy testing73 if($last_comm < (time() - (3600 * 3)) && !$is_first_run)74 continue; // it's already been reported enough for now...75 if(stripos($row['CurrentTask'], 'shutdown') !== false || stripos($row['CurrentTask'], 'shutting down') !== false)76 continue; // if the system shutdown, no reason to report it77 if(phoromatic_server::estimated_time_remaining_diff($row['EstimatedTimeForTask'], $row['LastCommunication']) > 0)78 continue; // system task time didn't run out yet79 // UPDATE SYSTEM STATUS TO "UNKNOWN"80 $stmt_unknown = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET CurrentTask = :unknown_state WHERE AccountID = :account_id AND SystemID = :system_id');81 $stmt_unknown->bindValue(':account_id', $row['AccountID']);82 $stmt_unknown->bindValue(':system_id', $row['SystemID']);83 $stmt_unknown->bindValue(':unknown_state', 'Unknown');84 $stmt_unknown->execute();85 $stmt_email = phoromatic_server::$db->prepare('SELECT UserName, Email FROM phoromatic_users WHERE UserID IN (SELECT UserID FROM phoromatic_user_settings WHERE AccountID = :account_id AND NotifyOnHungSystems = 1) AND AccountID = :account_id');86 $stmt_email->bindValue(':account_id', $row['AccountID']);87 $result_email = $stmt_email->execute();88 while($row_email = $result_email->fetchArray())89 {90 if(empty($row_email['Email']))91 continue;92 phoromatic_server::send_email($row_email['Email'], 'Phoromatic System Potential Hang: ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']), phoromatic_server::account_id_to_group_admin_email($row['AccountID']), '<p><strong>' . $row_email['UserName'] . ':</strong></p><p>One of the systems associated with your Phoromatic account has not been communicating with the Phoromatic Server in more than sixty minutes. Below is the system information details:</p><p><strong>System:</strong> ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']) . '<br /><strong>Last Communication:</strong> ' . phoromatic_server::user_friendly_timedate($row['LastCommunication']) . '<br /><strong>Last Task:</strong> ' . $row['CurrentTask'] . '<br /><strong>Local IP:</strong> ' . $row['LastIP'] . '</p>');93 }94 }95 }96 if($is_first_run || $minute % 2 == 0)97 {98 // Check for systems to wake99 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, SystemID, AccountID, NetworkMAC, LastIP, MaintenanceMode FROM phoromatic_systems WHERE State > 0 AND NetworkMAC NOT LIKE \'\' AND NetworkWakeOnLAN LIKE \'%g%\' ORDER BY LastCommunication DESC');100 $result = $stmt ? $stmt->execute() : false;101 while($result && $row = $result->fetchArray())102 {103 if(!isset($phoromatic_account_settings[$row['AccountID']]))104 {105 $stmt1 = phoromatic_server::$db->prepare('SELECT NetworkPowerUpWhenNeeded, PowerOnSystemDaily FROM phoromatic_account_settings WHERE AccountID = :account_id');106 $stmt1->bindValue(':account_id', $row['AccountID']);107 $result1 = $stmt1->execute();108 $phoromatic_account_settings[$row['AccountID']] = $result1->fetchArray(SQLITE3_ASSOC);109 }110 $last_comm = strtotime($row['LastCommunication']);111 if($last_comm < (time() - 360) && $row['MaintenanceMode'] == 1)112 {113 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);114 continue;115 }116 if($minute % 20 == 0 && $last_comm < (time() - (3600 * 18)) && $phoromatic_account_settings[$row['AccountID']]['PowerOnSystemDaily'] == 1)117 {118 // Daily power on test if system hasn't communicated / powered on in a day119 // XXX right now the "daily" power on test is 18 hours. change or make user value in future?120 // Just doing this check every 20 minutes as not too vital121 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);122 continue;123 }124 if($last_comm < (time() - 600) || stripos($row['CurrentTask'], 'Shutdown') !== false)125 {126 // System hasn't communicated in a number of minutes so it might be powered off127 if(phoromatic_server::system_has_outstanding_jobs($row['AccountID'], $row['SystemID']) !== false)128 {129 // Make sure account has network WoL enabled130 if($phoromatic_account_settings[$row['AccountID']]['NetworkPowerUpWhenNeeded'] == 1)131 {132 self::send_wol_wakeup($row['NetworkMAC'], $row['LastIP']);133 }134 }135 }136 }137 }138 if($minute % 8 == 0 && $hour > 1)139 {140 // See if system appears down141 $stmt = phoromatic_server::$db->prepare('SELECT LastCommunication, CurrentTask, SystemID, AccountID, LastIP FROM phoromatic_systems WHERE State > 0 ORDER BY LastCommunication DESC');142 $result = $stmt ? $stmt->execute() : false;143 while($result && ($row = $result->fetchArray()))144 {145 $sys_hash = sha1($row['AccountID'] . $row['SystemID']);146 // Avoid sending duplicate messages over time147 if(isset($systems_already_reported[$sys_hash]) && $systems_already_reported[$sys_hash] > (time() - (3600 * 24)))148 continue;149 if(phoromatic_server::system_check_if_down($row['AccountID'], $row['SystemID'], $row['LastCommunication'], $row['CurrentTask']))150 {151 if(strtotime($row['LastCommunication']) < (time() - (86400 * 7)))152 {153 // If system hasn't been online in a week, likely has bigger worries...154 continue;155 }156 $stmt_email = phoromatic_server::$db->prepare('SELECT UserName, Email FROM phoromatic_users WHERE UserID IN (SELECT UserID FROM phoromatic_user_settings WHERE AccountID = :account_id AND NotifyOnHungSystems = 1) AND AccountID = :account_id');157 $stmt_email->bindValue(':account_id', $row['AccountID']);158 $result_email = $stmt_email->execute();159 while($row_email = $result_email->fetchArray())160 {161 if(empty($row_email['Email']))162 continue;163 phoromatic_server::send_email($row_email['Email'], 'Phoromatic System Potential Problem: ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']), phoromatic_server::account_id_to_group_admin_email($row['AccountID']), '<p><strong>' . $row_email['UserName'] . ':</strong></p><p>One of the systems associated with your Phoromatic account has not been communicating with the Phoromatic Server and is part of a current active test schedule. Below is the system information details:</p><p><strong>System:</strong> ' . phoromatic_server::system_id_to_name($row['SystemID'], $row['AccountID']) . '<br /><strong>Last Communication:</strong> ' . phoromatic_server::user_friendly_timedate($row['LastCommunication']) . '<br /><strong>Last Task:</strong> ' . $row['CurrentTask'] . '<br /><strong>Local IP:</strong> ' . $row['LastIP'] . '</p>');164 }165 $systems_already_reported[$sys_hash] = time();166 }167 }168 }169 phoromatic_server::close_database();170 sleep((60 - date('s') + 1));171 $is_first_run = false;172 }173 }174}175?>...

Full Screen

Full Screen

phoromatic_server

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic_server.php');2require_once('phoromatic_account.php');3require_once('phoromatic_user.php');4require_once('phoromatic_results_viewer.php');5require_once('phoromatic_systems.php');6require_once('phoromatic_schedules.php');7require_once('phoromatic_settings.php');8require_once('phoromatic_comparisons.php');9require_once('phoromatic_upload.php');10require_once('phoromatic_test_profile.php');11require_once('phoromatic_test_profile_upload.php');12require_once('phoromatic_test_profile_edit.php');13require_once('phoromatic_test_profile_new.php');14require_once('phoromatic_test_profile_download.php');15require_once('phoromatic_test_profile_delete.php');16require_once('phoromatic_test_profile_run.php');17require_once('phoromatic_test_profile_results.php');18require_once('phoromatic_test_profile_result.php');19require_once('phoromatic_test_profile_result_delete.php

Full Screen

Full Screen

phoromatic_server

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/objects/phoromatic_server.php');2$server = new phoromatic_server();3$server->initialize_environment();4require_once('pts-core/objects/phoromatic_user.php');5$user = new phoromatic_user();6$user->initialize_environment();7require_once('pts-core/objects/phoromatic_account.php');8$account = new phoromatic_account();9$account->initialize_environment();10require_once('pts-core/objects/phoromatic_system_activity_viewer.php');11$activity_viewer = new phoromatic_system_activity_viewer();12$activity_viewer->initialize_environment();13require_once('pts-core/objects/phoromatic_results_viewer.php');14$results_viewer = new phoromatic_results_viewer();15$results_viewer->initialize_environment();16require_once('pts-core/objects/phoromatic_results_exporter.php');17$results_exporter = new phoromatic_results_exporter();18$results_exporter->initialize_environment();19require_once('pts-core/objects/phoromatic_results_viewer_upload.php');20$results_viewer_upload = new phoromatic_results_viewer_upload();21$results_viewer_upload->initialize_environment();22require_once('pts-core/objects/phoromatic_results_viewer_compare.php');23$results_viewer_compare = new phoromatic_results_viewer_compare();24$results_viewer_compare->initialize_environment();25require_once('pts-core/objects/phoromatic_results_viewer_compare.php');26$results_viewer_compare = new phoromatic_results_viewer_compare();27$results_viewer_compare->initialize_environment();

Full Screen

Full Screen

phoromatic_server

Using AI Code Generation

copy

Full Screen

1require_once('phoromatic_server.php');2$ptserver = new phoromatic_server();3$ptserver->init();4$ptserver->process_request();5{6 private $mysqli;7 private $base_url;8 private $request;9 private $request_type;10 private $request_id;11 private $request_action;12 private $request_data;13 private $request_data_id;14 private $request_data_value;15 private $request_data_value2;16 private $request_data_value3;17 private $request_data_value4;18 private $request_data_value5;19 private $request_data_value6;20 private $request_data_value7;21 private $request_data_value8;22 private $request_data_value9;23 private $request_data_value10;24 private $request_data_value11;25 private $request_data_value12;26 private $request_data_value13;27 private $request_data_value14;28 private $request_data_value15;29 private $request_data_value16;30 private $request_data_value17;31 private $request_data_value18;32 private $request_data_value19;33 private $request_data_value20;34 private $request_data_value21;35 private $request_data_value22;36 private $request_data_value23;37 private $request_data_value24;38 private $request_data_value25;39 private $request_data_value26;40 private $request_data_value27;41 private $request_data_value28;42 private $request_data_value29;43 private $request_data_value30;44 private $request_data_value31;45 private $request_data_value32;46 private $request_data_value33;47 private $request_data_value34;48 private $request_data_value35;49 private $request_data_value36;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful