Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Schedule workflow execution immediately #1544

Conversation

IzabellaRaulin
Copy link
Contributor

@IzabellaRaulin IzabellaRaulin commented Mar 6, 2017

Related to #985
This PR is a part of the work being planned related to a single run task.

Before:

  • waiting a period of time at the beginning of every spin()

After:

  • for the first spin(), do not wait on interval and schedule workflow execution immediately

Summary of changes:

  • the workflow is going to be scheduled for execution immediately
  • some typos fixed

Testing done:

  • manual tests
  • medium tests

@intelsdi-x/snap-maintainers

@IzabellaRaulin IzabellaRaulin changed the title Scheduled workflow execution immediately Schedule workflow execution immediately Mar 6, 2017
Copy link
Collaborator

@jcooklin jcooklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fixing tests this LGTM.

last = time.Now()
r = append(r, r1)
}
// we should have either 21 or 23 minus 0 missed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"We should have either 21 or 23?", is an odd/inaccurate comment given we are checking for a value between 20 and 22. It should probably read, "we expect a range between x and y".

Also, this test is flaky >50% of the time on my system.

img

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I see. I changed the comment through all tests to be more appropriate. Now for each of tests cases, window-width is 200ms, so for interval 10ms it is expected to get in a range 19 - 22 responses (or 15-18 for tests when there are some missed responses).
@jcooklin, could you run those tests on your system to confirm that?

Copy link
Collaborator

@jcooklin jcooklin Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 of 100 runs were successful!

@@ -50,26 +94,28 @@ func TestWindowedSchedule(t *testing.T) {
time.Sleep(w.Interval * 2)
}
}
// we should have either 16 or 17 minus 3 missed
So(len(r), ShouldBeBetweenOrEqual, 15, 17)
// we should have either 17 or 19 minus 4 missed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should read, "We should have results between x and y".

This test comes back with 15 around 10% of the time for me.

img

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test with 4 missed responses, the range has been changed to 15 -18.
Notice that for a test without missed responses, 19- 22 responses are expected to receive.

@@ -100,14 +147,23 @@ func TestWindowedSchedule(t *testing.T) {
time.Sleep(w.Interval * 2)
}
}
// we should have either 16 or 17 minus 3 missed
So(len(r), ShouldBeBetweenOrEqual, 10, 12)
// we should have either 12 or 14 results minus 4 missed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Should have between 12 and 14 results"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windowed width has been changed to 200ms to be more corresponding to the other tests-cases.

- applicable for simple and windowed schedule, not applicable for cron shedule
@IzabellaRaulin IzabellaRaulin force-pushed the task_starts_immediately_rebased branch from b8b22d5 to 9677fd5 Compare March 6, 2017 20:10
@IzabellaRaulin IzabellaRaulin merged commit 0b2c031 into intelsdi-x:master Mar 7, 2017
@ghost ghost mentioned this pull request Mar 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants