Skip to content

Commit

Permalink
Test integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Feb 7, 2025
1 parent 60027de commit 4461a53
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- qa/**
- stable/**
- dev/integration-test-test
jobs:
integration-tests:
runs-on: ubuntu-24.04
Expand Down
20 changes: 20 additions & 0 deletions lib/model/QubitJob.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
<?php
function prodlog($message = "", $value = "")
{
$logFile = "./log/qubit_prod.log";

if ($value != null) {
$logMessage = $message.": ";
if (is_string($value)) {
$logMessage .= $value;
} elseif (is_bool($value)) {
$logMessage .= $value ? 'true' : 'false';
} else {
$logMessage .= json_encode($value);
}
} else {
$logMessage =json_encode($message);
}

error_log("DEV LOG: " . $logMessage . "\n", 3, $logFile);
}

/*
* This file is part of the Access to Memory (AtoM) software.
Expand Down Expand Up @@ -393,6 +412,7 @@ private static function checkWorkerAvailable($jobName)
{
$manager = new Net_Gearman_Manager(arGearman::getServer(), 2);
$status = $manager->status();
prodlog('status', $status);

if (!array_key_exists($jobName, $status) || !$status[$jobName]['capable_workers']) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions vendor/net_gearman/Net/Gearman/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ public function status()
$this->sendCommand('status');
$res = $this->recvCommand();

$status = array();
$tmp = explode("\n", $res);
$status = [];
$tmp = explode("\n", $res);
foreach ($tmp as $t) {
if (!Net_Gearman_Connection::stringLength($t)) {
continue;
}

list($func, $inQueue, $jobsRunning, $capable) = explode("\t", $t);
[$func, $inQueue, $jobsRunning, $capable] = explode("\t", $t);

$status[$func] = array(
$status[$func] = [
'in_queue' => $inQueue,
'jobs_running' => $jobsRunning,
'capable_workers' => $capable
);
];
}

return $status;
Expand Down

0 comments on commit 4461a53

Please sign in to comment.