fetchTxnLogs.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. include_once '../util/Logger.php';
  3. include_once '../conf/Config.inc';
  4. include_once 'localDirs.php';
  5. include_once "../util/lock.php";
  6. include_once '../db/HMCDBAccessor.php';
  7. include_once "../orchestrator/HMC.php";
  8. include_once "../orchestrator/Service.php";
  9. include_once "../orchestrator/ServiceComponent.php";
  10. include_once "../db/Transaction.php";
  11. include_once "../db/OrchestratorDB.php";
  12. include_once "../puppet/DBReader.php";
  13. include_once "../puppet/PuppetInvoker.php";
  14. $dbPath = $GLOBALS["DB_PATH"];
  15. $clusterName = $_GET['clusterName'];
  16. $txnId = $_GET['txnId'];
  17. function fetchTxnLogs( $txnId )
  18. {
  19. global $dbPath;
  20. global $clusterName;
  21. $hmc = new HMC($dbPath, $clusterName);
  22. $logs = $hmc->getLogs($txnId);
  23. $progress = $hmc->getProgress($txnId);
  24. //REZXXX $logs = '';
  25. //REZXXX
  26. //REZXXX /* Generate long logs. */
  27. //REZXXX for($i = 0; $i < 100; $i++) {
  28. //REZXXX $logs .= "1111 <br/>";
  29. //REZXXX }
  30. return array ('logs' => $logs['subTxns'],
  31. 'progress' => $progress['subTxns']);
  32. }
  33. $result = fetchTxnLogs($txnId);
  34. /* Create the output data... */
  35. $jsonOutput = array(
  36. 'clusterName' => $clusterName,
  37. 'txnId' => $txnId,
  38. 'logs' => $result['logs'],
  39. 'progress' => $result['progress']);
  40. /* ...and spit it out. */
  41. header("Content-type: application/json");
  42. print (json_encode($jsonOutput));
  43. ?>