-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
chore(ci): fix flakiness, misc improvements #7605
Changes from all commits
f154aa5
f10b8cc
38d7536
cb62994
3154349
1114241
ba6139c
1b538af
2198d56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,26 +54,10 @@ jobs: | |
cache: 'pip' | ||
- name: Install dependencies | ||
run: ./metadata-ingestion/scripts/install_deps.sh | ||
- name: Calculate pip install plan | ||
id: "packages_checksum" | ||
run: | | ||
cd metadata-ingestion | ||
pip install pip -U # only 22.2 and above contains the --dry-run flag | ||
|
||
# only the last line of the output is the packages that will be installed | ||
pip install --dry-run -e .[dev] ${{ matrix.extraPythonRequirement }} | tail -n 1 > /tmp/would_be_installed.txt | ||
CHECKSUM=$(shasum /tmp/would_be_installed.txt | awk '{print $1}') | ||
echo "packages_checksum=$CHECKSUM" >> $GITHUB_OUTPUT | ||
- name: print dependencies | ||
id: print-dependency | ||
run: cat /tmp/would_be_installed.txt | ||
- uses: actions/cache@v3 | ||
id: cache-venv | ||
with: | ||
path: ./metadata-ingestion/venv/ | ||
key: ${{ runner.os }}-venv-${{ steps.packages_checksum.outputs.packages_checksum }}-${{ matrix.python-version }} | ||
- name: Install package | ||
run: ./gradlew :metadata-ingestion:installPackageOnly | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this just for debugging? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. Wanted to see how much time installing the package takes separately to the tests. |
||
- name: Run metadata-ingestion tests (extras ${{ matrix.extraPythonRequirement }}) | ||
run: ./gradlew -Pextra_pip_requirements='${{ matrix.extraPythonRequirement }}' :metadata-ingestion:${{ matrix.command }} | ||
run: ./gradlew -Pextra_pip_requirements='${{ matrix.extraPythonRequirement }}' :metadata-ingestion:${{ matrix.command }} -x :metadata-ingestion:installPackageOnly | ||
- name: pip freeze show list installed | ||
if: always() | ||
run: source metadata-ingestion/venv/bin/activate && pip freeze | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,3 +140,4 @@ dmypy.json | |
|
||
# Generated classes | ||
src/datahub/metadata/ | ||
.preflight_sentinel |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ if (!project.hasProperty("extra_pip_requirements")) { | |
} | ||
|
||
task checkPythonVersion(type: Exec) { | ||
commandLine python_executable, '-c', 'import sys; assert sys.version_info >= (3, 7)' | ||
commandLine python_executable, '-c', | ||
'import sys; assert (3, 11) > sys.version_info >= (3, 7), f"Python version {sys.version_info[:2]} not allowed"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change message to "Is too old" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? If someone is using 3.11 it won't be too old but too new. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh i missed the 3.11 part - then this is fine |
||
} | ||
|
||
task environmentSetup(type: Exec, dependsOn: checkPythonVersion) { | ||
|
@@ -22,10 +23,22 @@ task environmentSetup(type: Exec, dependsOn: checkPythonVersion) { | |
} | ||
|
||
task runPreFlightScript(type: Exec, dependsOn: environmentSetup) { | ||
def sentinel_file = ".preflight_sentinel" | ||
outputs.file(sentinel_file) | ||
commandLine "scripts/datahub_preflight.sh" | ||
commandLine 'bash', '-c', "touch ${sentinel_file}" | ||
} | ||
|
||
task installPackage(type: Exec, dependsOn: runPreFlightScript) { | ||
task installPackageOnly(type: Exec, dependsOn: runPreFlightScript) { | ||
def sentinel_file = "${venv_name}/.build_install_package_only_sentinel" | ||
inputs.file file('setup.py') | ||
outputs.dir("${venv_name}") | ||
outputs.file(sentinel_file) | ||
commandLine 'bash', '-x', '-c', "${venv_name}/bin/pip install -e ." | ||
commandLine 'bash', '-c', "touch ${sentinel_file}" | ||
} | ||
|
||
task installPackage(type: Exec, dependsOn: installPackageOnly) { | ||
inputs.file file('setup.py') | ||
outputs.dir("${venv_name}") | ||
commandLine 'bash', '-x', '-c', "${venv_name}/bin/pip install -e . ${extra_pip_requirements}" | ||
|
@@ -40,25 +53,27 @@ task codegen(type: Exec, dependsOn: [environmentSetup, installPackage, ':metadat | |
task install(dependsOn: [installPackage, codegen]) | ||
|
||
task installDev(type: Exec, dependsOn: [install]) { | ||
def sentinel_file = "${venv_name}/.build_install_dev_sentinel" | ||
inputs.file file('setup.py') | ||
outputs.dir("${venv_name}") | ||
outputs.file("${venv_name}/.build_install_dev_sentinel") | ||
outputs.file(sentinel_file) | ||
commandLine 'bash', '-c', | ||
"source ${venv_name}/bin/activate && set -x && " + | ||
"${venv_name}/bin/pip install -e .[dev] ${extra_pip_requirements} && " + | ||
"./scripts/install-sqlalchemy-stubs.sh && " + | ||
"touch ${venv_name}/.build_install_dev_sentinel" | ||
"touch ${sentinel_file}" | ||
} | ||
|
||
task installAll(type: Exec, dependsOn: [install]) { | ||
def sentinel_file = "${venv_name}/.build_install_all_sentinel" | ||
inputs.file file('setup.py') | ||
outputs.dir("${venv_name}") | ||
outputs.file("${venv_name}/.build_install_all_sentinel") | ||
outputs.file(sentinel_file) | ||
commandLine 'bash', '-c', | ||
"source ${venv_name}/bin/activate && set -x && " + | ||
"${venv_name}/bin/pip install -e .[all] ${extra_pip_requirements} && " + | ||
"./scripts/install-sqlalchemy-stubs.sh && " + | ||
"touch ${venv_name}/.build_install_all_sentinel" | ||
"touch ${sentinel_file}" | ||
} | ||
|
||
|
||
|
@@ -111,11 +126,12 @@ task testQuick(type: Exec, dependsOn: [installDev, ':metadata-models:generateJso | |
} | ||
|
||
task installDevTest(type: Exec, dependsOn: [install]) { | ||
def sentinel_file = "${venv_name}/.build_install_dev_test_sentinel" | ||
inputs.file file('setup.py') | ||
outputs.dir("${venv_name}") | ||
outputs.file("${venv_name}/.build_install_dev_test_sentinel") | ||
outputs.file(sentinel_file) | ||
commandLine 'bash', '-c', | ||
"${venv_name}/bin/pip install -e .[dev,integration-tests] ${extra_pip_requirements} && touch ${venv_name}/.build_install_dev_test_sentinel" | ||
"${venv_name}/bin/pip install -e .[dev,integration-tests] ${extra_pip_requirements} && touch ${sentinel_file}" | ||
} | ||
|
||
def testFile = hasProperty('testFile') ? testFile : 'unknown' | ||
|
@@ -176,6 +192,7 @@ clean { | |
delete 'generated' | ||
delete '.mypy_cache' | ||
delete '.pytest_cache' | ||
delete '.preflight_sentinel' | ||
} | ||
clean.dependsOn cleanPythonCache | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we comment this out instead? Do you actually know what the issue was here or just disabling because of issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no difference in run time. See
master
and this branch's runs. No time difference is there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird - that probably means the caching wasn't even working?