Skip to content

Commit

Permalink
Classifier: Log real file names
Browse files Browse the repository at this point in the history
see #588

Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Feb 2, 2023
1 parent 8821e15 commit 34d17b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Classifiers/Classifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function setMaxExecutionTime(int $time): void {
public function classifyFiles(string $model, array $queueFiles, int $timeout): \Generator {
$paths = [];
$processedFiles = [];
$fileNames = [];
$startTime = time();
foreach ($queueFiles as $queueFile) {
if ($this->maxExecutionTime > 0 && time() - $startTime > $this->maxExecutionTime) {
Expand Down Expand Up @@ -109,6 +110,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
}
$paths[] = $path;
$processedFiles[] = $queueFile;
$fileNames[] = $files[0]->getPath();
} catch (NotFoundException $e) {
$this->logger->warning('Could not find file', ['exception' => $e]);
try {
Expand Down Expand Up @@ -184,7 +186,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
$buffer .= "\n".$result;
continue;
}
$this->logger->debug('Result for ' . basename($paths[$i]) . ' = ' . $result);
$this->logger->debug('Result for ' . $fileNames[$i] .'(' . basename($paths[$i]) . ') = ' . $result);
try {
// decode json
$results = json_decode($result, true, 512, JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE);
Expand Down

0 comments on commit 34d17b1

Please sign in to comment.