Skip to content

CircleCI: run jobs in parallel #3634

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

Merged
merged 5 commits into from
Mar 26, 2019
Merged

CircleCI: run jobs in parallel #3634

merged 5 commits into from
Mar 26, 2019

Conversation

antoinerg
Copy link
Contributor

@antoinerg antoinerg commented Mar 13, 2019

This PR is a follow-up to #3612 to try to improve the runtime of our test suite and its robustness.

Here we do so by leveraging the parallelism option offered in CircleCI. I moved out test-bundle into its own job and proceeded to run test-jasmine and test-image in parallel.

The test-image routine had to modified for it to accept a list of mocks as command-line arguments (it used to only support one globbing pattern which wasn't suitable).

I selected a parallelism of 2 for a few jobs in order for them to run in ~ 4 minutes. Because we need to build first (~ 2 minutes), we end up with a total running time of roughly 6 minutes:
Screenshot_2019-03-13_17-52-09

@etpinard
Copy link
Contributor

etpinard commented Mar 19, 2019

This is brilliant. Thanks for looking into this @antoinerg !

Before going any further, I'd like to get @bpostlethwaite 's approval.

Off this branch, we have:

image

that is, a max of 8 containers are running simultaneously and 4 of those containers set parallelism: 2. @bpostlethwaite is this going to be take too juice much out of our CircleCI plan?

@antoinerg
Copy link
Contributor Author

antoinerg commented Mar 19, 2019

that is, a max of 8 containers are running simultaneously and 4 of those containers set parallelism: 2. @bpostlethwaite is this going to be take too juice much out of our CircleCI plan?

@etpinard this is a very valid concern that I was going to bring up to your attention. Little correction: I think we have 3 job with a parallelism of 2 so in total we use 5*1 + 3*2 = 11 containers.

One thing that concerned me was whether CircleCI would wait for 11 containers to be available to even start or would it execute each job sequentially if we're short on containers. I assume it does the latter but we should check to make sure our tests do not get queued up for long period of times.

@bpostlethwaite
Copy link
Member

Yes this is fine. If we need more containers we'll buy them. Please let me know if there is significant queuing!

@etpinard
Copy link
Contributor

@antoinerg looks like we have the green light 🚀

Before merging this thing, I noticed that the tests that get skipped are no longer logged. For example, in test-jasmine container off master, we have:

image

If I remember correctly, the spec reporter

var reporters = (isFullSuite && !argv.tags) ? ['dots', 'spec'] : ['progress'];

is responsible for this, along with its config object:

// use 'karma-spec-reporter' to log info about skipped specs
specReporter: {
suppressErrorSummary: true,
suppressFailed: true,
suppressPassed: true,
suppressSkipped: false,
showSpecTiming: false,
// use 'karma-fail-fast-reporter' to fail fast w/o conflicting
// with other karma plugins
failFast: false
},


I'm not sure how useful logging the skipped tests is. What do you think @antoinerg? Maybe we could add a CLI argument to allow devs to switch from

var reporters = ['dots', 'spec'];

// to
var reportes = ['progress'];

Thoughts?

@etpinard
Copy link
Contributor

Oh one more thing too, at present we shouldn't have to split the gl2d_* mocks from the others during npm run test-image (hmm but maybe the heatmapgl and pointcloud mocks still need their own test call).

So it would be nice, to bring all the pixel comparison tests into one container. Once that's done perhaps bump the parallelism to 3 in that container.

@antoinerg
Copy link
Contributor Author

Oh one more thing too, at present we shouldn't have to split the gl2d_* mocks from the others during npm run test-image (hmm but maybe the heatmapgl and pointcloud mocks still need their own test call).

One big difference between them and "regular" mocks is that we render them in queue instead of in batch:

plotly.js/package.json

Lines 37 to 38 in 12ce725

"test-image": "node tasks/test_image.js",
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",

Out of curiosity, what makes you think the following warning may not apply anymore?
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');

Anyway, I will test it out in a separate branch and let you know the result 😸

@etpinard
Copy link
Contributor

One big difference between them and "regular" mocks is that we render them in queue instead of in batch

Good eye. Yeah, we shouldn't have to run the gl2d image tests in a queue any more, but maybe the heatmapgl and pointcloud still behave weird.

@etpinard
Copy link
Contributor

Out of curiosity, what makes you think the following warning may not apply anymore?

That one sounds obsolete.

@etpinard etpinard mentioned this pull request Mar 25, 2019
3 tasks
@antoinerg
Copy link
Contributor Author

Oh one more thing too, at present we shouldn't have to split the gl2d_* mocks from the others during npm run test-image (hmm but maybe the heatmapgl and pointcloud mocks still need their own test call).

So it would be nice, to bring all the pixel comparison tests into one container. Once that's done perhaps bump the parallelism to 3 in that container.

Done in 609cdf8 and seems to work fine.

@antoinerg
Copy link
Contributor Author

I'm not sure how useful logging the skipped tests is. What do you think @antoinerg? Maybe we could add a CLI argument to allow devs to switch from

I think it is useful to show the skipped tests. I added a flag for it in b99672b.

* More info here:
* https://github.com/plotly/plotly.js/pull/1037
*/
function sortGl2dMockList(mockList) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we'll have to keep this:

Running

npm run test-image

off this branch fails at gl2d_pointcloud-basic:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could reproduce this issue locally! Nice catch 👀

With be33648, I reintroduced sortGl2dMockList and running npm run test-image completed without error 🎉

Copy link
Contributor

Choose a reason for hiding this comment

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

image

works for me too 🎉

;;

bundle)
set_tz
Copy link
Contributor

Choose a reason for hiding this comment

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

⚡ - no need to set the timezone in containers that run image tests (they have their own timezone in their docker container).

Copy link
Contributor

Choose a reason for hiding this comment

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

@etpinard would you please provide a pointer to this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what else can I say.

@etpinard
Copy link
Contributor

image

a thing of beauty. Thanks @antoinerg - looks like you're almost there!

@etpinard
Copy link
Contributor

Amazing work! 💃 💃

Feel free to ignore #3634 (review)

@antoinerg antoinerg merged commit 682eb66 into master Mar 26, 2019
@etpinard etpinard deleted the circleci-parallel branch March 28, 2019 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants