From f9d339bb2d54b9c312ad7004379dc36c7da3aa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Van=C3=AD=C4=8Dek?= Date: Mon, 10 Aug 2026 14:59:33 +0200 Subject: [PATCH] Remove the usage file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `out/usage.json` was read, validated and then handed to `Client::addJobUsage()`, which has had an empty body since 2019 — the payload was always discarded, on every runtime. Removes the whole read path: `UsageFileInterface`, `NullUsageFile`, `Configuration\Usage` and its adapter, the (unreferenced) usage JSON schema, the `TestUsageFile` double, and the `$usageFile` parameter threaded through `Runner::run()`, `runRow()`, `runComponent()` and `runImages()`. BC break: `Runner::run()` loses its fifth parameter. Behaviour change: a malformed `out/usage.json` no longer fails an otherwise successful job. That validation was the feature's only observable effect, and it had no counterpart on the k8sContainers runtime, so this also removes a dind/no-dind divergence. --- Resources/schemas/usage.json | 18 -- Tests/Runner/ArtifactsTest.php | 2 - Tests/Runner/RunnerConfigRowsTest.php | 13 -- Tests/Runner/RunnerTest.php | 182 +----------------- Tests/RunnerPart2/BranchedWorkspaceTest.php | 2 - Tests/RunnerPart2/NetworkPolicyTest.php | 2 - Tests/RunnerPart2/Runner2Test.php | 4 - Tests/TestUsageFile.php | 33 ---- .../ABS/RunnerAbsTest.php | 2 - .../BigQuery/RunnerBigQueryTest.php | 2 - .../GCS/RunnerGCSTest.php | 2 - phpstan-baseline.neon | 25 --- src/Docker/Configuration/Usage.php | 34 ---- src/Docker/Configuration/Usage/Adapter.php | 12 -- src/Docker/Runner.php | 13 -- src/Docker/Runner/UsageFile/NullUsageFile.php | 20 -- .../Runner/UsageFile/UsageFileInterface.php | 14 -- 17 files changed, 1 insertion(+), 379 deletions(-) delete mode 100644 Resources/schemas/usage.json delete mode 100644 Tests/TestUsageFile.php delete mode 100644 src/Docker/Configuration/Usage.php delete mode 100644 src/Docker/Configuration/Usage/Adapter.php delete mode 100644 src/Docker/Runner/UsageFile/NullUsageFile.php delete mode 100644 src/Docker/Runner/UsageFile/UsageFileInterface.php diff --git a/Resources/schemas/usage.json b/Resources/schemas/usage.json deleted file mode 100644 index 878a519e0..000000000 --- a/Resources/schemas/usage.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Usage File Manifest", - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "metric": { - "type": "string", - "minLength": 1 - }, - "value": { - "type": "number" - } - } - } -} diff --git a/Tests/Runner/ArtifactsTest.php b/Tests/Runner/ArtifactsTest.php index b5687a9b8..cee15ffa0 100644 --- a/Tests/Runner/ArtifactsTest.php +++ b/Tests/Runner/ArtifactsTest.php @@ -6,7 +6,6 @@ use Keboola\Artifacts\Result; use Keboola\DockerBundle\Docker\Runner\Output; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\StorageApi\BranchAwareClient as StorageApiClient; use Keboola\StorageApi\Client; @@ -120,7 +119,6 @@ private function runRunner(array $configuration, string $jobId, ?string $orchest 'run', 'run', $jobId, - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/Runner/RunnerConfigRowsTest.php b/Tests/Runner/RunnerConfigRowsTest.php index 96ba31614..c461d9cca 100644 --- a/Tests/Runner/RunnerConfigRowsTest.php +++ b/Tests/Runner/RunnerConfigRowsTest.php @@ -7,7 +7,6 @@ use Keboola\Csv\CsvFile; use Keboola\DockerBundle\Docker\JobDefinition; use Keboola\DockerBundle\Docker\Runner\StateFile; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Exception\UserException; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\InputMapping\Table\Options\InputTableOptions; @@ -170,7 +169,6 @@ public function testRunMultipleRows() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -234,7 +232,6 @@ public function testRunMultipleRowsWithContainerRootUserFeature() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -291,7 +288,6 @@ public function testRunMultipleRowsFiltered() 'run', 'run', '1234567', - new NullUsageFile(), ['row-2'], $outputs, null, @@ -325,7 +321,6 @@ public function testRunUnknownRow() 'run', 'run', '1234567', - new NullUsageFile(), ['row-2'], $outputs, null, @@ -341,7 +336,6 @@ public function testRunEmptyJobDefinitions() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -397,7 +391,6 @@ public function testRunDisabled() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -468,7 +461,6 @@ public function testRunRowDisabled() 'run', 'run', '1234567', - new NullUsageFile(), ['disabled-row'], $outputs, null, @@ -529,7 +521,6 @@ public function testRowMetadata() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -593,7 +584,6 @@ public function testExecutorStoreRowState() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -686,7 +676,6 @@ public function testExecutorStoreRowStateWithProcessor() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -753,7 +742,6 @@ public function testOutput() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -880,7 +868,6 @@ public function testRunRowAdaptiveInputMapping() 'run', 'run', '1234567', - new NullUsageFile(), ['row-1'], $outputs, null, diff --git a/Tests/Runner/RunnerTest.php b/Tests/Runner/RunnerTest.php index a844ccc1b..5f36bf932 100644 --- a/Tests/Runner/RunnerTest.php +++ b/Tests/Runner/RunnerTest.php @@ -14,10 +14,8 @@ use Keboola\DockerBundle\Docker\Runner; use Keboola\DockerBundle\Docker\Runner\Output; use Keboola\DockerBundle\Docker\Runner\StateFile; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\DockerBundle\Tests\ReflectionPropertyAccessTestCase; -use Keboola\DockerBundle\Tests\TestUsageFile; use Keboola\InputMapping\Table\Options\InputTableOptions; use Keboola\InputMapping\Table\Result\Column; use Keboola\InputMapping\Table\Result\TableInfo; @@ -325,7 +323,6 @@ public function testRunnerProcessors(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -480,7 +477,6 @@ public function testProcessorsImageParameters(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -603,7 +599,6 @@ public function testRunnerProcessorsSyncAction(): void 'test-action', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -680,7 +675,6 @@ public function testImageParametersDecrypt(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -744,7 +738,6 @@ public function testClearStateWithNamespace(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -817,7 +810,6 @@ public function testExecutorDefaultBucketWithDot(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -871,7 +863,6 @@ public function testExecutorStoreState(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -931,7 +922,6 @@ public function testExecutorStoreStateEncryptsValue(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1001,7 +991,6 @@ public function testExecutorReadNamespacedState(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1073,7 +1062,6 @@ public function testExecutorStoreStateWithProcessor(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1177,7 +1165,6 @@ public function testExecutorStoreStateRows(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1282,7 +1269,6 @@ public function testSynchronousOutputMappingErrorsAreReported(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1416,7 +1402,6 @@ public function testAsynchronousOutputMappingErrorsAreReported(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1505,7 +1490,6 @@ public function testExecutorStoreStateWithProcessorError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1626,7 +1610,6 @@ public function testExecutorAfterProcessorNoState(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1750,7 +1733,6 @@ public function testExecutorBeforeProcessorNoState(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1808,7 +1790,6 @@ public function testExecutorNoStoreState(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1854,7 +1835,6 @@ public function testExecutorStateNoConfigId(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1909,7 +1889,6 @@ public function testExecutorNoConfigIdNoMetadata(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -1968,7 +1947,6 @@ public function testExecutorInvalidConfiguration(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2028,7 +2006,6 @@ public function testExecutorDefaultBucketNoStage(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2091,7 +2068,6 @@ public function testExecutorSyncActionNoStorage(): void 'some-sync-action', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2154,7 +2130,6 @@ public function testExecutorNoStorage(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2218,7 +2193,6 @@ public function testExecutorApplicationError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2278,7 +2252,6 @@ public function testExecutorUserError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2318,7 +2291,6 @@ public function testExecutorApplicationErrorDisabled(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2358,7 +2330,6 @@ public function testExecutorApplicationErrorDisabledButStillError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2407,7 +2378,6 @@ public function testExecutorInvalidInputMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2470,7 +2440,6 @@ public function testExecutorFillsInputFilesStateAndInputTableResultOnUserError() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2535,7 +2504,6 @@ public function testExecutorInvalidInputMapping2(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2597,7 +2565,6 @@ public function testExecutorSlicedFilesWithComponentRootUserFeature(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2667,7 +2634,6 @@ public function testExecutorSlicedFilesWithoutComponentRootUserFeature(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2720,7 +2686,6 @@ public function testAuthorizationDecrypt(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2773,7 +2738,6 @@ public function testTokenObfuscate(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -2788,51 +2752,6 @@ public function testTokenObfuscate(): void self::assertStringContainsString('[hidden]', $output); } - public function testExecutorStoreUsage(): void - { - $this->clearConfigurations(); - $usageFile = new TestUsageFile(); - $component = new Components($this->getClient()); - $configuration = new Configuration(); - $configuration->setComponentId('keboola.docker-demo-sync'); - $configuration->setName('Test configuration'); - $configuration->setConfigurationId('runner-configuration'); - $component->addConfiguration($configuration); - $componentData = [ - 'id' => 'keboola.docker-demo-sync', - 'data' => [ - 'definition' => [ - 'type' => 'aws-ecr', - // phpcs:ignore Generic.Files.LineLength.MaxExceeded - 'uri' => '147946154733.dkr.ecr.us-east-1.amazonaws.com/developer-portal-v2/keboola.python-transformation', - ], - ], - ]; - $configData = [ - 'parameters' => [ - 'script' => [ - 'with open("/data/out/usage.json", "w") as file:', - ' file.write(\'[{"metric": "kB", "value": 150}]\')', - ], - ], - ]; - $jobDefinition = new JobDefinition( - $configData, - new ComponentSpecification($componentData), - 'runner-configuration', - ); - $runner = $this->getRunner(); - $outputs = []; - $runner->run([$jobDefinition], 'run', 'run', '987654', $usageFile, [], $outputs, null); - self::assertEquals( - [[[ - 'metric' => 'kB', - 'value' => 150, - ]]], - $usageFile->getUsageData(), - ); - } - public function testExecutorStoreVariables(): void { $this->clearConfigurations(); @@ -2877,7 +2796,6 @@ public function testExecutorStoreVariables(): void 'run', 'run', '987654', - new NullUsageFile(), [], $outputs, null, @@ -2888,97 +2806,12 @@ public function testExecutorStoreVariables(): void self::assertSame($variableValues, $output->getInputVariableValues()); } - public function testExecutorStoreRowsUsage(): void - { - $this->clearConfigurations(); - $usageFile = new TestUsageFile(); - - $component = new Components($this->getClient()); - $configuration = new Configuration(); - $configuration->setComponentId('keboola.docker-demo-sync'); - $configuration->setName('Test configuration'); - $configuration->setConfigurationId('runner-configuration'); - $component->addConfiguration($configuration); - - $configurationRow = new ConfigurationRow($configuration); - $configurationRow->setRowId('row-1'); - $configurationRow->setName('Row 1'); - $component->addConfigurationRow($configurationRow); - - $configurationRow = new ConfigurationRow($configuration); - $configurationRow->setRowId('row-2'); - $configurationRow->setName('Row 2'); - $component->addConfigurationRow($configurationRow); - - $componentData = [ - 'id' => 'keboola.docker-demo-sync', - 'data' => [ - 'definition' => [ - 'type' => 'aws-ecr', - // phpcs:ignore Generic.Files.LineLength.MaxExceeded - 'uri' => '147946154733.dkr.ecr.us-east-1.amazonaws.com/developer-portal-v2/keboola.python-transformation', - ], - ], - ]; - $configData = [ - 'parameters' => [ - 'script' => [ - 'with open("/data/out/usage.json", "w") as file:', - ' file.write(\'[{"metric": "kB", "value": 150}]\')', - ], - ], - ]; - - $jobDefinition1 = new JobDefinition( - $configData, - new ComponentSpecification($componentData), - 'runner-configuration', - null, - [], - 'row-1', - ); - $jobDefinition2 = new JobDefinition( - $configData, - new ComponentSpecification($componentData), - 'runner-configuration', - null, - [], - 'row-2', - ); - $runner = $this->getRunner(); - $outputs = []; - $runner->run( - [$jobDefinition1, $jobDefinition2], - 'run', - 'run', - '987654', - $usageFile, - [], - $outputs, - null, - ); - self::assertEquals( - [ - [[ - 'metric' => 'kB', - 'value' => 150, - ]], - [[ - 'metric' => 'kB', - 'value' => 150, - ]], - ], - $usageFile->getUsageData(), - ); - } - /** * @dataProvider swapFeatureProvider */ public function testExecutorSwap($features): void { $this->clearConfigurations(); - $usageFile = new NullUsageFile(); $component = new Components($this->getClient()); $configuration = new Configuration(); $configuration->setComponentId('keboola.docker-demo-sync'); @@ -3008,7 +2841,7 @@ public function testExecutorSwap($features): void ); $runner = $this->getRunner(); $outputs = []; - $runner->run([$jobDefinition], 'run', 'run', '987654', $usageFile, [], $outputs, null); + $runner->run([$jobDefinition], 'run', 'run', '987654', [], $outputs, null); self::assertCount(1, $outputs); self::assertEquals("Script file /data/script.py\nScript finished", $outputs[0]->getProcessOutput()); } @@ -3141,7 +2974,6 @@ public function testRunAdaptiveInputMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3246,7 +3078,6 @@ public function testWorkspaceMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3321,7 +3152,6 @@ public function testWorkspaceMappingCleanupComponentError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3407,7 +3237,6 @@ public function testWorkspaceMappingCleanupMappingError(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3489,7 +3318,6 @@ public function testS3StagingMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3575,7 +3403,6 @@ public function testStorageFilesOutputProcessed(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3656,7 +3483,6 @@ public function testOutputTablesAsFiles(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3734,7 +3560,6 @@ public function testOutputTablesAsFilesWithMissingTableFiles(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3809,7 +3634,6 @@ public function testOutputTablesOnJobFailureManifest(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3897,7 +3721,6 @@ public function testOutputTablesOnJobFailureWorkspace(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -3972,7 +3795,6 @@ public function testOutputTablesOnJobFailureOriginalErrorNotConcealed(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -4059,7 +3881,6 @@ public function testOutputTablesOnJobFailureRecoverableOutputMappingError(): voi 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -4133,7 +3954,6 @@ public function testOutputTablesOnJobFailureNonRecoverableOutputMappingError(): 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/RunnerPart2/BranchedWorkspaceTest.php b/Tests/RunnerPart2/BranchedWorkspaceTest.php index 4f9eff8a6..f5a3b268c 100644 --- a/Tests/RunnerPart2/BranchedWorkspaceTest.php +++ b/Tests/RunnerPart2/BranchedWorkspaceTest.php @@ -10,7 +10,6 @@ use Keboola\DockerBundle\Docker\JobDefinition; use Keboola\DockerBundle\Docker\OutputFilter\OutputFilter; use Keboola\DockerBundle\Docker\Runner; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\JobQueue\JobConfiguration\JobDefinition\Component\ComponentSpecification; use Keboola\StagingProvider\Workspace\Configuration\NetworkPolicy; @@ -260,7 +259,6 @@ private function runJob(ClientWrapper $storageApiWrapper, JobDefinition $jobDefi 'run', 'run', '123456', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/RunnerPart2/NetworkPolicyTest.php b/Tests/RunnerPart2/NetworkPolicyTest.php index 4cb7753c7..22a5d2004 100644 --- a/Tests/RunnerPart2/NetworkPolicyTest.php +++ b/Tests/RunnerPart2/NetworkPolicyTest.php @@ -5,7 +5,6 @@ namespace Keboola\DockerBundle\Tests\RunnerPart2; use Keboola\Csv\CsvFile; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Exception\ApplicationException; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\StorageApi\BranchAwareClient; @@ -89,7 +88,6 @@ public function testWorkspaceMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/RunnerPart2/Runner2Test.php b/Tests/RunnerPart2/Runner2Test.php index 48383613a..e952bb0f4 100644 --- a/Tests/RunnerPart2/Runner2Test.php +++ b/Tests/RunnerPart2/Runner2Test.php @@ -6,7 +6,6 @@ use Keboola\CommonExceptions\UserExceptionInterface; use Keboola\DockerBundle\Docker\JobDefinition; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\DockerBundle\Tests\ReflectionPropertyAccessTestCase; use Keboola\JobQueue\JobConfiguration\JobDefinition\Component\ComponentSpecification; @@ -96,7 +95,6 @@ public function testPermissionsFailedWithoutContainerRootUserFeature() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -147,7 +145,6 @@ public function testTimeoutFromComponent(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, @@ -215,7 +212,6 @@ public function testTimeoutFromConfig(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/TestUsageFile.php b/Tests/TestUsageFile.php deleted file mode 100644 index 6d96ebf74..000000000 --- a/Tests/TestUsageFile.php +++ /dev/null @@ -1,33 +0,0 @@ -dataDir = $dataDir; - } - - public function storeUsage(): void - { - $usageFileName = $this->dataDir . '/out/usage.json'; - $this->usage[] = json_decode(file_get_contents($usageFileName), true); - } - - public function getUsageData() - { - return $this->usage; - } - - public function __construct() - { - } -} diff --git a/Tests/backend-specific-tests/ABS/RunnerAbsTest.php b/Tests/backend-specific-tests/ABS/RunnerAbsTest.php index 7a7e81b4d..5dab3ac9a 100644 --- a/Tests/backend-specific-tests/ABS/RunnerAbsTest.php +++ b/Tests/backend-specific-tests/ABS/RunnerAbsTest.php @@ -5,7 +5,6 @@ namespace Keboola\DockerBundle\BackendTests\ABS; use Keboola\Csv\CsvFile; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\StorageApi\Client; use Keboola\StorageApi\ClientException; @@ -99,7 +98,6 @@ public function testAbsStagingMapping() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/backend-specific-tests/BigQuery/RunnerBigQueryTest.php b/Tests/backend-specific-tests/BigQuery/RunnerBigQueryTest.php index b0579d532..42af85674 100644 --- a/Tests/backend-specific-tests/BigQuery/RunnerBigQueryTest.php +++ b/Tests/backend-specific-tests/BigQuery/RunnerBigQueryTest.php @@ -5,7 +5,6 @@ namespace Keboola\DockerBundle\BackendTests\BigQuery; use Keboola\Csv\CsvFile; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\Runner\BaseTableBackendTest; use Keboola\StorageApi\Client; use Keboola\StorageApi\ClientException; @@ -123,7 +122,6 @@ public function testWorkspaceBigQueryMapping(): void 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/Tests/backend-specific-tests/GCS/RunnerGCSTest.php b/Tests/backend-specific-tests/GCS/RunnerGCSTest.php index 6f18a5ee7..9a1876540 100644 --- a/Tests/backend-specific-tests/GCS/RunnerGCSTest.php +++ b/Tests/backend-specific-tests/GCS/RunnerGCSTest.php @@ -6,7 +6,6 @@ use Keboola\Csv\CsvFile; use Keboola\DockerBundle\Docker\JobDefinition; -use Keboola\DockerBundle\Docker\Runner\UsageFile\NullUsageFile; use Keboola\DockerBundle\Tests\BaseRunnerTest; use Keboola\DockerBundle\Tests\Runner\BackendAssertsTrait; use Keboola\JobQueue\JobConfiguration\JobDefinition\Component\ComponentSpecification; @@ -161,7 +160,6 @@ public function testWorkspaceSnowflakeMapping() 'run', 'run', '1234567', - new NullUsageFile(), [], $outputs, null, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 837c5ede2..b6daad710 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -775,26 +775,6 @@ parameters: count: 1 path: Tests/StorageApiHandler.php - - - message: "#^Method Keboola\\\\DockerBundle\\\\Tests\\\\TestUsageFile\\:\\:getUsageData\\(\\) has no return type specified\\.$#" - count: 1 - path: Tests/TestUsageFile.php - - - - message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" - count: 1 - path: Tests/TestUsageFile.php - - - - message: "#^Property Keboola\\\\DockerBundle\\\\Tests\\\\TestUsageFile\\:\\:\\$dataDir has no type specified\\.$#" - count: 1 - path: Tests/TestUsageFile.php - - - - message: "#^Property Keboola\\\\DockerBundle\\\\Tests\\\\TestUsageFile\\:\\:\\$usage has no type specified\\.$#" - count: 1 - path: Tests/TestUsageFile.php - - message: "#^Cannot access offset 'id' on mixed\\.$#" count: 1 @@ -955,11 +935,6 @@ parameters: count: 1 path: src/Docker/Configuration/State.php - - - message: "#^Call to method scalarNode\\(\\) on an unknown class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeBuilder\\\\.$#" - count: 1 - path: src/Docker/Configuration/Usage.php - - message: "#^Call to method arrayNode\\(\\) on an unknown class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeBuilder\\\\.$#" count: 1 diff --git a/src/Docker/Configuration/Usage.php b/src/Docker/Configuration/Usage.php deleted file mode 100644 index 2141472c9..000000000 --- a/src/Docker/Configuration/Usage.php +++ /dev/null @@ -1,34 +0,0 @@ -getRootNode(); - - $rootNode - ->prototype('array') - ->children() - ->scalarNode('metric') - ->isRequired() - ->cannotBeEmpty() - ->end() - ->scalarNode('value') - ->isRequired() - ->cannotBeEmpty() - ->end() - ->end() - ->end() - ; - - return $treeBuilder; - } -} diff --git a/src/Docker/Configuration/Usage/Adapter.php b/src/Docker/Configuration/Usage/Adapter.php deleted file mode 100644 index 80a7ab753..000000000 --- a/src/Docker/Configuration/Usage/Adapter.php +++ /dev/null @@ -1,12 +0,0 @@ -setInputVariableValues($jobDefinition->getInputVariableValues()); } - $usageFile->setDataDir($workingDirectory->getDataDir()); - $tokenInfo = $this->clientWrapper->getBranchClient()->verifyToken(); $jobScopedEncryptor = new JobScopedEncryptor( $this->encryptor, @@ -291,7 +287,6 @@ private function runRow( $jobDefinition->getConfigVersion(), $jobDefinition->getRowId(), $component, - $usageFile, $this->stagingWorkspace, $inputDataLoader, $outputDataLoader, @@ -325,7 +320,6 @@ public function run( string $action, string $mode, string $jobId, - UsageFileInterface $usageFile, array $rowIds, array &$outputs, ?string $backendSize, @@ -374,7 +368,6 @@ public function run( $action, $mode, $jobId, - $usageFile, $outputs, $backendSize, $storeState, @@ -434,7 +427,6 @@ private function runComponent( ?string $configVersion, ?string $rowId, ComponentSpecification $component, - UsageFileInterface $usageFile, ?StagingWorkspaceFacade $stagingWorkspace, ?InputDataLoader $inputDataLoader, ?OutputDataLoader $outputDataLoader, @@ -463,7 +455,6 @@ private function runComponent( $configVersion, $rowId, $component, - $usageFile, $workingDirectory, $imageCreator, $configFile, @@ -525,7 +516,6 @@ private function runImages( ?string $configVersion, ?string $rowId, ComponentSpecification $component, - UsageFileInterface $usageFile, WorkingDirectory $workingDirectory, ImageCreator $imageCreator, ConfigFile $configFile, @@ -674,9 +664,6 @@ private function runImages( if ($image->getSourceComponent()->runAsRoot()) { $workingDirectory->normalizePermissions(); } - if ($image->isMain()) { - $usageFile->storeUsage(); - } } $counter++; if ($counter < count($images)) { diff --git a/src/Docker/Runner/UsageFile/NullUsageFile.php b/src/Docker/Runner/UsageFile/NullUsageFile.php deleted file mode 100644 index dceff7dad..000000000 --- a/src/Docker/Runner/UsageFile/NullUsageFile.php +++ /dev/null @@ -1,20 +0,0 @@ -