Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ R submit(@Getter WorkflowInstance workflowInstance, ExecutionDescription executi

// Note: Do not make changes to these deprecated event method signatures
@Deprecated
R timeTrigger(@Getter WorkflowInstance workflowInstance);
@Deprecated
R created(@Getter WorkflowInstance workflowInstance, String executionId, String dockerImage);
@Deprecated
R retry(@Getter WorkflowInstance workflowInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

@JsonTypeInfo(use = Id.NAME, visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = PersistentEvent.class, name = "timeTrigger"),
@JsonSubTypes.Type(value = PersistentEvent.TriggerExecution.class, name = "triggerExecution"),
@JsonSubTypes.Type(value = PersistentEvent.Info.class, name = "info"),
@JsonSubTypes.Type(value = PersistentEvent.Created.class, name = "created"),
Expand Down Expand Up @@ -71,10 +70,6 @@ class PersistentEvent {

public static class SerializerVisitor implements EventVisitor<PersistentEvent> {

@Override
public PersistentEvent timeTrigger(WorkflowInstance workflowInstance) {
return new PersistentEvent("timeTrigger", workflowInstance.toKey());
}

@Override
public PersistentEvent triggerExecution(WorkflowInstance workflowInstance, Trigger trigger,
Expand Down Expand Up @@ -169,8 +164,6 @@ public static PersistentEvent wrap(Event event) {
public Event toEvent() {
final WorkflowInstance workflowInstance = WorkflowInstance.parseKey(this.workflowInstance);
switch (type) {
case "timeTrigger":
return Event.timeTrigger(workflowInstance);
case "success":
return Event.success(workflowInstance);
case "retry":
Expand Down
10 changes: 0 additions & 10 deletions styx-common/src/main/java/com/spotify/styx/util/EventUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ public static String info(Event event) {
private enum EventInfoVisitor implements EventVisitor<String> {
INSTANCE;

@Override
public String timeTrigger(WorkflowInstance workflowInstance) {
return "";
}

@Override
public String triggerExecution(WorkflowInstance workflowInstance, Trigger trigger,
TriggerParameters parameters) {
Expand Down Expand Up @@ -145,11 +140,6 @@ public String submitted(WorkflowInstance workflowInstance, String executionId, S
private enum EventNameVisitor implements EventVisitor<String> {
INSTANCE;

@Override
public String timeTrigger(WorkflowInstance workflowInstance) {
return "timeTrigger";
}

@Override
public String triggerExecution(WorkflowInstance workflowInstance, Trigger trigger,
TriggerParameters parameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class PersistentEventTest {

@Test
public void testRoundtripAllEvents() throws Exception {
assertRoundtrip(Event.timeTrigger(INSTANCE1));
assertRoundtrip(Event.triggerExecution(INSTANCE1, UNKNOWN_TRIGGER, TRIGGER_PARAMETERS));
assertRoundtrip(Event.info(INSTANCE1, Message.info("InfoMessage")));
assertRoundtrip(Event.created(INSTANCE1, POD_NAME, DOCKER_IMAGE));
Expand All @@ -87,7 +86,6 @@ public void testRoundtripAllEvents() throws Exception {

@Test
public void testDeserializeFromJson() throws Exception {
assertThat(deserializeEvent(json("timeTrigger")), is(Event.timeTrigger(INSTANCE1)));
assertThat(deserializeEvent(json("dequeue", "\"resource_ids\":[\"quux\"]")),
is(Event.dequeue(INSTANCE1, ImmutableSet.of("quux"))));
assertThat(deserializeEvent(json("dequeue")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,6 @@ private void closeWatch() {
// fixme: add a Cause enum to the runError() event instead of this string matching
private static class PullImageErrorMatcher implements EventVisitor<Boolean> {

@Override
public Boolean timeTrigger(WorkflowInstance workflowInstance) {
return false;
}

@Override
public Boolean triggerExecution(WorkflowInstance workflowInstance, Trigger trigger,
TriggerParameters parameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void shouldRejectTriggerIfIsClosed() throws Exception {
public void shouldRejectEventIfClosed() throws Exception {
stateManager.close();
exception.expect(IsClosedException.class);
stateManager.receive(Event.timeTrigger(INSTANCE));
stateManager.receive(Event.triggerExecution(INSTANCE, Trigger.natural(), TriggerParameters.zero()));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,6 @@ private RunState transitionUpdates(Instant instant) {

private class TransitionVisitor implements EventVisitor<RunState> {

@Deprecated
@Override
public RunState timeTrigger(WorkflowInstance workflowInstance) {
switch (state()) {
case NEW:
return state( // for backwards compatibility
SUBMITTED,
data().builder()
.trigger(Trigger.unknown("UNKNOWN"))
.triggerId("UNKNOWN") // for backwards compatibility
.build());

default:
throw illegalTransition("timeTrigger");
}
}

@Override
public RunState triggerExecution(WorkflowInstance workflowInstance, Trigger trigger,
TriggerParameters parameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ private void closeTrigger() {

private class Reducer implements EventVisitor<Void> {

@Override
public Void timeTrigger(WorkflowInstance workflowInstance) {
currWorkflowInstance = workflowInstance;
completed = false;

triggerTs = eventTs;
return null;
}

@Override
public Void triggerExecution(WorkflowInstance workflowInstance, com.spotify.styx.state.Trigger trigger,
TriggerParameters parameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public WorkflowInstanceEventFactory(WorkflowInstance workflowInstance) {
this.workflowInstance = workflowInstance;
}

public Event timeTrigger() {
return Event.timeTrigger(workflowInstance);
}

public Event triggerExecution(Trigger trigger) {
return triggerExecution(trigger, TriggerParameters.zero());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ public void testTransitionUpdates() {
@Test // for backwards compatibility
public void testTimeTriggerAndRetry() {
transitioner.initialize(RunState.fresh(WORKFLOW_INSTANCE));
transitioner.receive(eventFactory.timeTrigger());
// TODO: double check that this is the right event
transitioner.receive(eventFactory.triggerExecution(UNKNOWN_TRIGGER));
transitioner.receive(eventFactory.dequeue(ImmutableSet.of()));
transitioner.receive(eventFactory.submit(EXECUTION_DESCRIPTION, "exec1"));
transitioner.receive(eventFactory.submitted("exec1"));
transitioner.receive(eventFactory.started());
transitioner.receive(eventFactory.terminate(1));
transitioner.receive(eventFactory.retryAfter(777));
Expand Down Expand Up @@ -182,7 +186,11 @@ public void testTimeTriggerAndRetry2() {
@Test
public void testRunErrorOnCreating() {
transitioner.initialize(RunState.fresh(WORKFLOW_INSTANCE));
transitioner.receive(eventFactory.timeTrigger());
// TODO: double check that this is the right event
transitioner.receive(eventFactory.triggerExecution(UNKNOWN_TRIGGER));
transitioner.receive(eventFactory.dequeue(ImmutableSet.of()));
transitioner.receive(eventFactory.submit(EXECUTION_DESCRIPTION, "exec1"));
transitioner.receive(eventFactory.submitted("exec1"));
transitioner.receive(eventFactory.started());
transitioner.receive(eventFactory.terminate(1));
transitioner.receive(eventFactory.retryAfter(777));
Expand Down