Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename common package to common #17809

Closed
wants to merge 11 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.temporal.sync;
package io.airbyte.commons.temporal.sync;

import com.uber.m3.util.ImmutableSet;
import io.airbyte.commons.features.EnvVariableFeatureFlags;
Expand Down
65 changes: 65 additions & 0 deletions airbyte-commons-worker/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.jsonschema2pojo.SourceType

plugins {
id "java-library"
id 'com.github.eirnym.js2p' version '1.0'
}

group 'io.airbyte...'
version '0.40.14'

repositories {
mavenCentral()
}

dependencies {
annotationProcessor platform(libs.micronaut.bom)
annotationProcessor libs.bundles.micronaut.annotation.processor

implementation platform(libs.micronaut.bom)
implementation libs.bundles.micronaut

implementation 'io.fabric8:kubernetes-client:5.12.2'
implementation 'io.temporal:temporal-sdk:1.8.1'
implementation 'org.apache.ant:ant:1.10.10'
implementation 'org.apache.commons:commons-text:1.9'

implementation project(':airbyte-commons-protocol')
implementation project(':airbyte-commons-temporal')
implementation project(':airbyte-config:config-models')
implementation project(':airbyte-json-validation')
implementation project(':airbyte-metrics:metrics-lib')
implementation project(':airbyte-persistence:job-persistence')
implementation project(':airbyte-protocol:protocol-models')

testAnnotationProcessor platform(libs.micronaut.bom)
testAnnotationProcessor libs.bundles.micronaut.test.annotation.processor

testImplementation libs.bundles.micronaut.test
testImplementation 'com.jayway.jsonpath:json-path:2.7.0'
testImplementation 'org.mockito:mockito-inline:4.7.0'
testImplementation libs.postgresql
testImplementation libs.platform.testcontainers
testImplementation libs.platform.testcontainers.postgresql

testImplementation project(':airbyte-commons-docker')
}

jsonSchema2Pojo {
sourceType = SourceType.YAMLSCHEMA
source = files("${sourceSets.main.output.resourcesDir}/workers_models")
targetDirectory = new File(project.buildDir, 'generated/src/gen/java/')
removeOldOutput = true

targetPackage = 'io.airbyte.persistence.job.models'

useLongIntegers = true
generateBuilders = true
includeConstructors = false
includeSetters = true
}

Properties env = new Properties()
rootProject.file('.env.dev').withInputStream { env.load(it) }

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import io.airbyte.commons.worker.storage.DocumentStoreClient;
import io.airbyte.config.Configs.WorkerEnvironment;
import io.airbyte.workers.general.DocumentStoreClient;
import io.fabric8.kubernetes.client.KubernetesClient;

public record ContainerOrchestratorConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.airbyte.commons.worker.exception.RecordSchemaValidationException;
import io.airbyte.protocol.models.AirbyteRecordMessage;
import io.airbyte.validation.json.JsonSchemaValidator;
import io.airbyte.validation.json.JsonValidationException;
import io.airbyte.workers.exception.RecordSchemaValidationException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import io.airbyte.workers.exception.WorkerException;
import io.airbyte.workers.general.DefaultReplicationWorker;
import io.airbyte.commons.worker.exception.WorkerException;
import java.nio.file.Path;

public interface Worker<InputType, OutputType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import io.airbyte.config.Configs;
import io.airbyte.config.ResourceRequirements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

public class WorkerConstants {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import io.airbyte.metrics.lib.MetricAttribute;
import io.airbyte.metrics.lib.MetricClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers;
package io.airbyte.commons.worker;

import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.config.ConnectorJobOutput;
Expand All @@ -16,9 +16,9 @@
import io.airbyte.protocol.models.AirbyteMessage;
import io.airbyte.protocol.models.AirbyteMessage.Type;
import io.airbyte.protocol.models.AirbyteTraceMessage;
import io.airbyte.workers.exception.WorkerException;
import io.airbyte.workers.helper.FailureHelper;
import io.airbyte.workers.helper.FailureHelper.ConnectorCommand;
import io.airbyte.commons.worker.exception.WorkerException;
import io.airbyte.commons.worker.helper.FailureHelper;
import io.airbyte.commons.worker.helper.FailureHelper.ConnectorCommand;
import java.nio.file.Path;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.config;
package io.airbyte.commons.worker.config;

import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import io.airbyte.commons.worker.WorkerConfigs;
import io.airbyte.commons.map.MoreMaps;
import io.airbyte.config.Configs.DeploymentMode;
import io.airbyte.config.Configs.WorkerEnvironment;
import io.airbyte.config.ResourceRequirements;
import io.airbyte.config.TolerationPOJO;
import io.airbyte.workers.WorkerConfigs;
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Requires;
import io.micronaut.context.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.config;
package io.airbyte.commons.worker.config;

/**
* Defines the different execution modes for the workers application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.exception;
package io.airbyte.commons.worker.exception;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.exception;
package io.airbyte.commons.worker.exception;

public class WorkerException extends Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.general;
package io.airbyte.commons.worker.general;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import io.airbyte.commons.worker.WorkerUtils;
import io.airbyte.commons.worker.process.AirbyteIntegrationLauncher;
import io.airbyte.commons.worker.process.ProcessFactory;
import io.airbyte.commons.io.LineGobbler;
import io.airbyte.commons.logging.LoggingHelper.Color;
import io.airbyte.commons.logging.MdcScope;
import io.airbyte.commons.logging.MdcScope.Builder;
import io.airbyte.commons.resources.MoreResources;
import io.airbyte.config.OperatorDbt;
import io.airbyte.config.ResourceRequirements;
import io.airbyte.workers.WorkerUtils;
import io.airbyte.workers.exception.WorkerException;
import io.airbyte.workers.normalization.NormalizationRunner;
import io.airbyte.workers.process.AirbyteIntegrationLauncher;
import io.airbyte.workers.process.ProcessFactory;
import io.airbyte.commons.worker.exception.WorkerException;
import io.airbyte.commons.worker.normalization.NormalizationRunner;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.general;
package io.airbyte.commons.worker.general;

import io.airbyte.commons.worker.Worker;
import io.airbyte.commons.io.LineGobbler;
import io.airbyte.config.OperatorDbtInput;
import io.airbyte.config.ResourceRequirements;
import io.airbyte.workers.Worker;
import io.airbyte.workers.exception.WorkerException;
import io.airbyte.commons.worker.exception.WorkerException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.general;
package io.airbyte.commons.worker.general;

import io.airbyte.commons.io.LineGobbler;
import io.airbyte.config.Configs.WorkerEnvironment;
import io.airbyte.config.FailureReason;
import io.airbyte.config.NormalizationInput;
import io.airbyte.config.NormalizationSummary;
import io.airbyte.protocol.models.AirbyteTraceMessage;
import io.airbyte.workers.exception.WorkerException;
import io.airbyte.workers.helper.FailureHelper;
import io.airbyte.workers.normalization.NormalizationRunner;
import io.airbyte.workers.normalization.NormalizationWorker;
import io.airbyte.commons.worker.exception.WorkerException;
import io.airbyte.commons.worker.helper.FailureHelper;
import io.airbyte.commons.worker.normalization.NormalizationRunner;
import io.airbyte.commons.worker.normalization.NormalizationWorker;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.general;
package io.airbyte.commons.worker.general;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.airbyte.commons.worker.WorkerUtils;
import io.airbyte.commons.worker.internal.AirbyteDestination;
import io.airbyte.commons.worker.internal.AirbyteMapper;
import io.airbyte.commons.worker.internal.AirbyteSource;
import io.airbyte.commons.worker.internal.MessageTracker;
import io.airbyte.commons.io.LineGobbler;
import io.airbyte.config.FailureReason;
import io.airbyte.config.ReplicationAttemptSummary;
Expand All @@ -19,14 +24,11 @@
import io.airbyte.protocol.models.AirbyteMessage;
import io.airbyte.protocol.models.AirbyteMessage.Type;
import io.airbyte.protocol.models.AirbyteRecordMessage;
import io.airbyte.workers.*;
import io.airbyte.workers.exception.RecordSchemaValidationException;
import io.airbyte.workers.exception.WorkerException;
import io.airbyte.workers.helper.FailureHelper;
import io.airbyte.workers.internal.AirbyteDestination;
import io.airbyte.workers.internal.AirbyteMapper;
import io.airbyte.workers.internal.AirbyteSource;
import io.airbyte.workers.internal.MessageTracker;
import io.airbyte.commons.worker.RecordSchemaValidator;
import io.airbyte.commons.worker.WorkerMetricReporter;
import io.airbyte.commons.worker.exception.RecordSchemaValidationException;
import io.airbyte.commons.worker.exception.WorkerException;
import io.airbyte.commons.worker.helper.FailureHelper;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.general;
package io.airbyte.commons.worker.general;

import io.airbyte.commons.worker.Worker;
import io.airbyte.config.ReplicationOutput;
import io.airbyte.config.StandardSyncInput;
import io.airbyte.workers.Worker;

public interface ReplicationWorker extends Worker<StandardSyncInput, ReplicationOutput> {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.helper;
package io.airbyte.commons.worker.helper;

import com.fasterxml.jackson.annotation.JsonValue;
import io.airbyte.config.AttemptFailureSummary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.internal;
package io.airbyte.commons.worker.internal;

import io.airbyte.commons.functional.CheckedConsumer;
import io.airbyte.config.WorkerDestinationConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.internal;
package io.airbyte.commons.worker.internal;

import io.airbyte.protocol.models.AirbyteMessage;
import io.airbyte.protocol.models.ConfiguredAirbyteCatalog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.internal;
package io.airbyte.commons.worker.internal;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import io.airbyte.commons.worker.internal.StateMetricsTracker.StateMetricsTrackerNoStateMatchException;
import io.airbyte.commons.worker.internal.state_aggregator.DefaultStateAggregator;
import io.airbyte.commons.worker.internal.state_aggregator.StateAggregator;
import io.airbyte.commons.features.EnvVariableFeatureFlags;
import io.airbyte.commons.json.Jsons;
import io.airbyte.config.FailureReason;
Expand All @@ -19,10 +22,7 @@
import io.airbyte.protocol.models.AirbyteStateMessage;
import io.airbyte.protocol.models.AirbyteStateMessage.AirbyteStateType;
import io.airbyte.protocol.models.AirbyteTraceMessage;
import io.airbyte.workers.helper.FailureHelper;
import io.airbyte.workers.internal.StateMetricsTracker.StateMetricsTrackerNoStateMatchException;
import io.airbyte.workers.internal.state_aggregator.DefaultStateAggregator;
import io.airbyte.workers.internal.state_aggregator.StateAggregator;
import io.airbyte.commons.worker.helper.FailureHelper;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.workers.internal;
package io.airbyte.commons.worker.internal;

import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.protocol.models.AirbyteProtocolSchema;
Expand Down
Loading