-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes after rebase fix python tests
- Loading branch information
Showing
45 changed files
with
1,300 additions
and
1,948 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
core/src/main/java/feast/core/dao/FeatureSetJobStatusRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
core/src/main/java/feast/core/job/InMemoryJobRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2018-2020 The Feast Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package feast.core.job; | ||
|
||
import com.google.common.collect.Lists; | ||
import feast.common.models.FeatureSetReference; | ||
import feast.core.model.Job; | ||
import feast.core.model.JobStatus; | ||
import feast.proto.core.SourceProto; | ||
import java.util.*; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Collectors; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class InMemoryJobRepository implements JobRepository { | ||
private final JobManager jobManager; | ||
|
||
private Map<String, Job> storage; | ||
|
||
@Autowired | ||
public InMemoryJobRepository(JobManager jobManager) { | ||
this.jobManager = jobManager; | ||
this.storage = new HashMap<>(); | ||
|
||
this.storage = | ||
this.jobManager.listJobs().stream().collect(Collectors.toMap(Job::getId, j -> j)); | ||
} | ||
|
||
@Override | ||
public Optional<Job> findFirstBySourceAndStoreNameAndStatusNotInOrderByLastUpdatedDesc( | ||
SourceProto.Source source, String storeName, Collection<JobStatus> statuses) { | ||
return this.storage.values().stream() | ||
.filter( | ||
j -> | ||
j.getSource().equals(source) | ||
&& (storeName == null || j.getStores().containsKey(storeName)) | ||
&& (!statuses.contains(j.getStatus()))) | ||
.max(Comparator.comparing(Job::getLastUpdated)); | ||
} | ||
|
||
private List<Job> findWithFilter(Predicate<Job> p) { | ||
return this.storage.values().stream().filter(p).collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public List<Job> findByStatus(JobStatus status) { | ||
return this.findWithFilter(j -> j.getStatus().equals(status)); | ||
} | ||
|
||
@Override | ||
public List<Job> findByFeatureSetReference(FeatureSetReference reference) { | ||
return this.findWithFilter(j -> j.getFeatureSetDeliveryStatuses().containsKey(reference)); | ||
} | ||
|
||
@Override | ||
public List<Job> findByJobStoreName(String storeName) { | ||
return this.findWithFilter(j -> j.getStores().containsKey(storeName)); | ||
} | ||
|
||
@Override | ||
public Optional<Job> findById(String jobId) { | ||
return Optional.ofNullable(this.storage.get(jobId)); | ||
} | ||
|
||
@Override | ||
public List<Job> findAll() { | ||
return Lists.newArrayList(this.storage.values()); | ||
} | ||
|
||
@Override | ||
public void add(Job job) { | ||
job.preSave(); | ||
|
||
this.storage.put(job.getId(), job); | ||
} | ||
|
||
@Override | ||
public void deleteAll() { | ||
this.storage.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.