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

[ci] speed up conda setup for some jobs #5668

Merged
merged 4 commits into from
Jan 27, 2023
Merged

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Jan 9, 2023

In #5648 , I saw that conda create-ing an environment in one shot was significantly faster in some situations than conda create-ing an environment and then updating it with conda install or conda update (#5647 (comment)).

That PR was for Windows CI jobs.

This PR proposes similar changes to some of the macOS and Linux jobs.

  • moves lint, if-else, and swig job code up earlier in .ci/test.sh
    • swig job doesn't need a conda environment, so time in that job spent waiting for conda create is wasted time
    • lint and if-else have very different conda-installed dependencies than the other jobs, so they can be totally self-contained and just conda create their own environment with everything they need

benefits of this change

I observed the following timing differences in these jobs on this PR, compared to master:

job latest master this PR
(GHA) macOS if-else 06m33s 07m04s
(GHA) check-docs 04m08s 03m30s
(Azure) Linux inference 04m52s 04m36s
(Azure) Linux swig 04m55s 04m02s
(Azure) Linux_latest inference 04m07s 03m56s
(Azure) macOS swig 07m42s 05m05s

this PR:

latest master build:

Notes for Reviewers

Given all the things that can change from run-to-run, it's hard to trust small differences in the timings based on 1 or even a few of runs. But I'm still pretty confident that these changes make these CI jobs at least a small amount faster, without reducing their stability.

If this PR is accepted, I'll propose another one after that consolidates these into a single conda create for the remaining tasks:

conda create -q -y -n $CONDA_ENV "python=$PYTHON_VERSION[build=*cpython]"

LightGBM/.ci/test.sh

Lines 126 to 140 in 61e464b

# re-including python=version[build=*cpython] to ensure that conda doesn't fall back to pypy
conda install -q -y -n $CONDA_ENV \
cloudpickle \
dask-core \
distributed \
joblib \
matplotlib \
numpy \
pandas \
psutil \
pytest \
"python=$PYTHON_VERSION[build=*cpython]" \
python-graphviz \
scikit-learn \
scipy || exit -1

@jameslamb jameslamb changed the title WIP: [ci] speed up if-else, swig, and lint conda setup [ci] speed up conda setup for some jobs Jan 9, 2023
@jameslamb jameslamb marked this pull request as ready for review January 9, 2023 05:17
@jameslamb jameslamb requested a review from StrikerRUS as a code owner January 9, 2023 05:17
@jameslamb
Copy link
Collaborator Author

@jmoralez could you help with a review on this? I think it should be quick and non-controversial.

@jameslamb
Copy link
Collaborator Author

thanks @jmoralez !

@jameslamb jameslamb merged commit ad68f13 into master Jan 27, 2023
@jameslamb jameslamb deleted the ci/faster-ci-setup branch January 27, 2023 03:58
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants