Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit 0fa12f2

Browse files
jpetterssonATspotifyckiosidis
authored andcommitted
removed created event
1 parent 8743989 commit 0fa12f2

File tree

12 files changed

+53
-139
lines changed

12 files changed

+53
-139
lines changed

styx-api-service/src/test/java/com/spotify/styx/api/StatusResourceTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public void testEventsRoundtrip() throws Exception {
132132
sinceVersion(Api.Version.V3);
133133

134134
storage.writeEvent(SequenceEvent.create(Event.triggerExecution(WFI_1, TRIGGER, TriggerParameters.zero()), 0L, 0L));
135-
storage.writeEvent(SequenceEvent.create(Event.created(WFI_1, "exec0", "img0"), 1L, 1L));
136135
storage.writeEvent(SequenceEvent.create(Event.started(WFI_1), 2L, 2L));
137136

138137
Response<ByteString> response =

styx-api-service/src/test/java/com/spotify/styx/api/WorkflowResourceTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static com.spotify.styx.model.SequenceEvent.create;
3131
import static com.spotify.styx.serialization.Json.deserialize;
3232
import static com.spotify.styx.serialization.Json.serialize;
33+
import static com.spotify.styx.testdata.TestData.EXECUTION_DESCRIPTION;
3334
import static org.hamcrest.Matchers.empty;
3435
import static org.hamcrest.Matchers.equalTo;
3536
import static org.hamcrest.Matchers.hasSize;
@@ -49,6 +50,7 @@
4950

5051
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
5152
import com.google.cloud.datastore.Datastore;
53+
import com.google.common.collect.ImmutableSet;
5254
import com.spotify.apollo.Environment;
5355
import com.spotify.apollo.Response;
5456
import com.spotify.apollo.Status;
@@ -342,7 +344,7 @@ public void shouldReturnWorkflowInstancesData() throws Exception {
342344

343345
WorkflowInstance wfi = WorkflowInstance.create(WORKFLOW.id(), "2016-08-10");
344346
storage.writeEvent(create(Event.triggerExecution(wfi, NATURAL_TRIGGER, TRIGGER_PARAMETERS), 0L, ms("07:00:00")));
345-
storage.writeEvent(create(Event.created(wfi, "exec", "img"), 1L, ms("07:00:01")));
347+
storage.writeEvent(create(Event.dequeue(wfi, ImmutableSet.of()), 1L, ms("07:00:01")));
346348
storage.writeEvent(create(Event.started(wfi), 2L, ms("07:00:02")));
347349

348350
Response<ByteString> response =
@@ -383,7 +385,7 @@ public void shouldReturnWorkflowRangeOfInstancesData() throws Exception {
383385

384386
WorkflowInstance wfi = WorkflowInstance.create(WORKFLOW.id(), "2016-08-10");
385387
storage.writeEvent(create(Event.triggerExecution(wfi, NATURAL_TRIGGER, TRIGGER_PARAMETERS), 0L, ms("07:00:00")));
386-
storage.writeEvent(create(Event.created(wfi, "exec", "img"), 1L, ms("07:00:01")));
388+
storage.writeEvent(create(Event.dequeue(wfi, ImmutableSet.of()), 1L, ms("07:00:01")));
387389
storage.writeEvent(create(Event.started(wfi), 2L, ms("07:00:02")));
388390

389391
Response<ByteString> response =
@@ -412,8 +414,10 @@ public void shouldReturnWorkflowInstanceData() throws Exception {
412414

413415
WorkflowInstance wfi = WorkflowInstance.create(WORKFLOW.id(), "2016-08-10");
414416
storage.writeEvent(create(Event.triggerExecution(wfi, NATURAL_TRIGGER, TRIGGER_PARAMETERS), 0L, ms("07:00:00")));
415-
storage.writeEvent(create(Event.created(wfi, "exec", "img"), 1L, ms("07:00:01")));
416-
storage.writeEvent(create(Event.started(wfi), 2L, ms("07:00:02")));
417+
storage.writeEvent(create(Event.dequeue(wfi, ImmutableSet.of()), 1L, ms("07:00:01")));
418+
storage.writeEvent(create(Event.submit(wfi, EXECUTION_DESCRIPTION, "exec"), 2L, ms("07:00:02")));
419+
storage.writeEvent(create(Event.submitted(wfi, "exec", "test"), 3L, ms("07:00:03")));
420+
storage.writeEvent(create(Event.started(wfi), 4L, ms("07:00:04")));
417421

418422
Response<ByteString> response =
419423
awaitResponse(serviceHelper.request("GET", path("/foo/bar/instances/2016-08-10")));
@@ -429,7 +433,7 @@ public void shouldReturnWorkflowInstanceData() throws Exception {
429433
assertJson(response, "triggers.[0].complete", is(false));
430434
assertJson(response, "triggers.[0].executions", hasSize(1));
431435
assertJson(response, "triggers.[0].executions.[0].execution_id", is("exec"));
432-
assertJson(response, "triggers.[0].executions.[0].docker_image", is("img"));
436+
assertJson(response, "triggers.[0].executions.[0].docker_image", is("busybox:1.1"));
433437
assertJson(response, "triggers.[0].executions.[0].statuses", hasSize(2));
434438
assertJson(response, "triggers.[0].executions.[0].statuses.[0].status", is("SUBMITTED"));
435439
assertJson(response, "triggers.[0].executions.[0].statuses.[1].status", is("STARTED"));

styx-common/src/main/java/com/spotify/styx/model/EventVisitor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,5 @@ R submit(@Getter WorkflowInstance workflowInstance, ExecutionDescription executi
5353

5454
// Note: Do not make changes to these deprecated event method signatures
5555
@Deprecated
56-
R created(@Getter WorkflowInstance workflowInstance, String executionId, String dockerImage);
57-
@Deprecated
5856
R retry(@Getter WorkflowInstance workflowInstance);
5957
}

styx-common/src/main/java/com/spotify/styx/serialization/PersistentEvent.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
@JsonSubTypes({
4444
@JsonSubTypes.Type(value = PersistentEvent.TriggerExecution.class, name = "triggerExecution"),
4545
@JsonSubTypes.Type(value = PersistentEvent.Info.class, name = "info"),
46-
@JsonSubTypes.Type(value = PersistentEvent.Created.class, name = "created"),
4746
@JsonSubTypes.Type(value = PersistentEvent.Dequeue.class, name = "dequeue"),
4847
@JsonSubTypes.Type(value = PersistentEvent.Started.class, name = "started"),
4948
@JsonSubTypes.Type(value = PersistentEvent.Terminate.class, name = "terminate"),
@@ -82,11 +81,6 @@ public PersistentEvent info(WorkflowInstance workflowInstance, Message message)
8281
return new Info(workflowInstance.toKey(), message);
8382
}
8483

85-
@Override
86-
public PersistentEvent created(WorkflowInstance workflowInstance, String executionId, String dockerImage) {
87-
return new Created(workflowInstance.toKey(), executionId, Optional.of(dockerImage));
88-
}
89-
9084
@Override
9185
public PersistentEvent dequeue(WorkflowInstance workflowInstance, Set<String> resourceIds) {
9286
return new Dequeue(workflowInstance.toKey(), Optional.of(resourceIds));
@@ -232,28 +226,6 @@ public Event toEvent() {
232226
}
233227
}
234228

235-
236-
public static class Created extends PersistentEvent {
237-
238-
public final String executionId;
239-
public final String dockerImage;
240-
241-
@JsonCreator
242-
public Created(
243-
@JsonProperty("workflow_instance") String workflowInstance,
244-
@JsonProperty("execution_id") String executionId,
245-
@JsonProperty("docker_image") Optional<String> dockerImage) {
246-
super("created", workflowInstance);
247-
this.executionId = executionId;
248-
this.dockerImage = dockerImage.orElse("UNKNOWN");
249-
}
250-
251-
@Override
252-
public Event toEvent() {
253-
return Event.created(WorkflowInstance.parseKey(workflowInstance), executionId, dockerImage);
254-
}
255-
}
256-
257229
public static class Submitted extends PersistentEvent {
258230

259231
public final String executionId;

styx-common/src/main/java/com/spotify/styx/util/EventUtil.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ public String info(WorkflowInstance workflowInstance, Message message) {
6767
return message.line();
6868
}
6969

70-
@Override
71-
public String created(WorkflowInstance workflowInstance, String executionId, String dockerImage) {
72-
return String.format("Execution id: %s, Docker image: %s", executionId, dockerImage);
73-
}
74-
7570
@Override
7671
public String dequeue(WorkflowInstance workflowInstance, Set<String> resourceIds) {
7772
return "";
@@ -156,12 +151,6 @@ public String dequeue(WorkflowInstance workflowInstance, Set<String> resourceIds
156151
return "dequeue";
157152
}
158153

159-
@Override
160-
public String created(WorkflowInstance workflowInstance, String executionId,
161-
String dockerImage) {
162-
return "created";
163-
}
164-
165154
@Override
166155
public String started(WorkflowInstance workflowInstance) {
167156
return "started";

styx-common/src/test/java/com/spotify/styx/serialization/PersistentEventTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class PersistentEventTest {
6868
public void testRoundtripAllEvents() throws Exception {
6969
assertRoundtrip(Event.triggerExecution(INSTANCE1, UNKNOWN_TRIGGER, TRIGGER_PARAMETERS));
7070
assertRoundtrip(Event.info(INSTANCE1, Message.info("InfoMessage")));
71-
assertRoundtrip(Event.created(INSTANCE1, POD_NAME, DOCKER_IMAGE));
7271
assertRoundtrip(Event.dequeue(INSTANCE1, ImmutableSet.of("some-resource")));
7372
assertRoundtrip(Event.dequeue(INSTANCE1, ImmutableSet.of()));
7473
assertRoundtrip(Event.started(INSTANCE1));
@@ -121,10 +120,6 @@ public void testDeserializeFromJson() throws Exception {
121120
deserializeEvent(json("submitted", "\"execution_id\":\"" + POD_NAME + "\",\"runner_id\":\"" + RUNNER_ID
122121
+ "\"")),
123122
is(Event.submitted(INSTANCE1, POD_NAME, RUNNER_ID)));
124-
assertThat(
125-
deserializeEvent(json("created", "\"execution_id\":\"" + POD_NAME + "\",\"docker_image\":\"" + DOCKER_IMAGE
126-
+ "\"")),
127-
is(Event.created(INSTANCE1, POD_NAME, DOCKER_IMAGE)));
128123
assertThat(
129124
deserializeEvent(json("runError", "\"message\":\"ErrorMessage\"")),
130125
is(Event.runError(INSTANCE1, "ErrorMessage")));
@@ -166,9 +161,6 @@ public void testDeserializeFromJsonWhenTransformationRequired() throws Exception
166161
assertThat(
167162
deserializeEvent(json("started", "\"pod_name\":\"" + POD_NAME + "\"")),
168163
is(Event.started(INSTANCE1))); // for backwards compatibility
169-
assertThat(
170-
deserializeEvent(json("created", "\"execution_id\":\"" + POD_NAME + "\"")),
171-
is(Event.created(INSTANCE1, POD_NAME, "UNKNOWN")));
172164
assertThat(
173165
deserializeEvent(json("triggerExecution")),
174166
is(Event.triggerExecution(INSTANCE1, TRIGGER_UNKNOWN, TriggerParameters.zero())));

styx-scheduler-service/src/main/java/com/spotify/styx/docker/KubernetesDockerRunner.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,6 @@ public Boolean dequeue(WorkflowInstance workflowInstance, Set<String> resourceId
804804
return false;
805805
}
806806

807-
@Override
808-
public Boolean created(WorkflowInstance workflowInstance, String executionId, String dockerImage) {
809-
return false;
810-
}
811-
812807
@Override
813808
public Boolean submit(WorkflowInstance workflowInstance, ExecutionDescription executionDescription,
814809
String executionId) {

styx-service-common/src/main/java/com/spotify/styx/state/RunState.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,6 @@ public RunState triggerExecution(WorkflowInstance workflowInstance, Trigger trig
141141
}
142142
}
143143

144-
@Deprecated
145-
@Override
146-
public RunState created(WorkflowInstance workflowInstance, String executionId,
147-
String dockerImage) {
148-
switch (state()) {
149-
case PREPARE:
150-
case QUEUED:
151-
return state(
152-
SUBMITTED, // for backwards compatibility
153-
data().builder()
154-
.executionId(executionId)
155-
.executionDescription(ExecutionDescription.forImage(dockerImage))
156-
.tries(data().tries() + 1)
157-
.build());
158-
159-
default:
160-
throw illegalTransition("created");
161-
}
162-
}
163-
164144
@Override
165145
public RunState info(WorkflowInstance workflowInstance, Message message) {
166146
switch (state()) {

styx-service-common/src/main/java/com/spotify/styx/storage/WFIExecutionBuilder.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,6 @@ public Void dequeue(WorkflowInstance workflowInstance, Set<String> resourceIds)
124124
return null;
125125
}
126126

127-
@Override
128-
public Void created(WorkflowInstance workflowInstance, String executionId, String dockerImage) {
129-
currWorkflowInstance = workflowInstance;
130-
currExecutionId = executionId;
131-
currDockerImg = dockerImage;
132-
133-
executionStatusList.add(ExecStatus.create(eventTs, Status.SUBMITTED.toString(),
134-
Optional.empty()));
135-
return null;
136-
}
137-
138127
@Override
139128
public Void submit(WorkflowInstance workflowInstance, ExecutionDescription executionDescription,
140129
String executionId) {

styx-service-common/src/test/java/com/spotify/styx/WorkflowInstanceEventFactory.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ public Event info(Message message) {
5151
return Event.info(workflowInstance, message);
5252
}
5353

54-
public Event created(String executionId, String dockerImage) {
55-
return Event.created(workflowInstance, executionId, dockerImage);
56-
}
57-
5854
public Event dequeue(Set<String> resourceIds) {
5955
return Event.dequeue(workflowInstance, resourceIds);
6056
}

0 commit comments

Comments
 (0)