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

Change error store to be part of configuration instead #39

Merged
merged 9 commits into from
Jan 9, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@

package feast.ingestion.transform;

import static feast.ingestion.util.JsonUtil.convertJsonStringToMap;

import com.google.inject.Inject;
import feast.ingestion.model.Specs;
import feast.ingestion.options.ImportJobOptions;
@@ -26,18 +28,16 @@
import feast.storage.ErrorsStore;
import feast.storage.noop.NoOpIO;
import feast.types.FeatureRowExtendedProto.FeatureRowExtended;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PDone;
import org.slf4j.event.Level;

import java.util.List;

import static feast.ingestion.util.JsonUtil.convertJsonStringToMap;

@Slf4j
public class ErrorsStoreTransform extends FeatureIO.Write {

public static final String ERRORS_STORE_STDERR = "stderr";
public static final String ERRORS_STORE_STDOUT = "stdout";
public static final String ERRORS_STORE_JSON = "file.json";
Original file line number Diff line number Diff line change
@@ -20,14 +20,14 @@
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import feast.storage.ErrorsStore;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ErrorsStoreService {

private static ServiceLoader<ErrorsStore> serviceLoader = ServiceLoader.load(ErrorsStore.class);
private static List<ErrorsStore> manuallyRegistered = new ArrayList<>();

@@ -39,10 +39,12 @@ public class ErrorsStoreService {

public static List<ErrorsStore> getAll() {
return Lists.newArrayList(
Iterators.concat(manuallyRegistered.iterator(), serviceLoader.iterator()));
Iterators.concat(manuallyRegistered.iterator(), serviceLoader.iterator()));
}

/** Get store of the given subclass. */
/**
* Get store of the given subclass.
*/
public static <T extends ErrorsStore> T get(Class<T> clazz) {
for (ErrorsStore store : getAll()) {
if (clazz.isInstance(store)) {
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

@AutoService(ServingStore.class)
public class MockServingStore extends MockFeatureStore implements ServingStore {
public static final String MOCK_SERVING_STORE_TYPE = "MOCK_SERVING_STORE";
public static final String MOCK_SERVING_STORE_TYPE = "serving.mock";

public MockServingStore() {
super(MOCK_SERVING_STORE_TYPE);
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

@AutoService(WarehouseStore.class)
public class MockWarehouseStore extends MockFeatureStore implements WarehouseStore {
public static final String MOCK_WAREHOUSE_STORE_TYPE = "MOCK_WAREHOUSE_STORE";
public static final String MOCK_WAREHOUSE_STORE_TYPE = "warehouse.mock";

public MockWarehouseStore() {
super(MOCK_WAREHOUSE_STORE_TYPE);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "TEST_SERVING",
"type": "MOCK_SERVING_STORE",
"type": "serving.mock",
"options": {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "TEST_WAREHOUSE",
"type": "MOCK_WAREHOUSE_STORE",
"type": "warehouse.mock",
"options": {}
}