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

Fetch Job's Created Datetime from Dataflow #966

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 8 additions & 3 deletions job-controller/src/main/java/feast/jobcontroller/model/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public Date getLastUpdated() {
}

public void preSave() {
if (created == null) {
created = new Date();
if (this.created == null) {
this.created = new Date();
}
lastUpdated = new Date();
this.lastUpdated = new Date();
}

public void setExtId(String extId) {
Expand All @@ -102,6 +102,11 @@ public void setStatus(JobStatus status) {
this.status = status;
}

public void setCreated(Date created) {
this.created = created;
this.lastUpdated = created;
}

public boolean hasTerminated() {
return getStatus().isTerminal();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.apache.beam.runners.dataflow.DataflowRunner;
import org.apache.beam.sdk.PipelineResult.State;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.joda.time.DateTime;

@Slf4j
public class DataflowJobManager implements JobManager {
Expand Down Expand Up @@ -307,6 +308,9 @@ public List<Job> listRunningJobs() {

job.setExtId(dfJob.getId());
job.setStatus(JobStatus.RUNNING);
if (dfJob.getCreateTime() != null) {
job.setCreated(DateTime.parse(dfJob.getCreateTime()).toDate());
}

return job;
})
Expand Down
4 changes: 2 additions & 2 deletions job-controller/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ feast:
workerMachineType: n1-standard-1
deadLetterTableSpec: project_id:dataset_id.table_id
kafkaConsumerProperties:
"max.poll.records": "50000"
"receive.buffer.bytes": "33554432"
"[max.poll.records]": "50000"
"[receive.buffer.bytes]": "33554432"

# Configuration options for metric collection for all ingestion jobs
metrics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import org.apache.beam.runners.dataflow.DataflowRunner;
import org.apache.beam.sdk.PipelineResult.State;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
Expand Down Expand Up @@ -237,6 +239,8 @@ public void shouldRetrieveRunningJobsFromDataflow() {

Printer jsonPrinter = JsonFormat.printer();

LocalDateTime created = DateTime.now().toLocalDateTime();

when(dataflow
.projects()
.locations()
Expand All @@ -248,6 +252,7 @@ public void shouldRetrieveRunningJobsFromDataflow() {
new com.google.api.services.dataflow.model.Job()
.setLabels(ImmutableMap.of("application", "feast"))
.setId("job-2")
.setCreateTime(created.toString())
.setEnvironment(
new Environment()
.setSdkPipelineOptions(
Expand All @@ -268,7 +273,9 @@ public void shouldRetrieveRunningJobsFromDataflow() {
hasProperty("id", equalTo("kafka-to-redis")),
hasProperty("source", equalTo(source)),
hasProperty("stores", hasValue(store)),
hasProperty("extId", equalTo("job-2")))));
hasProperty("extId", equalTo("job-2")),
hasProperty("created", equalTo(created.toDate())),
hasProperty("lastUpdated", equalTo(created.toDate())))));
}

@Test
Expand Down