Skip to content

Commit e0dabe7

Browse files
committed
Enable memory profiling
1 parent 81f3b91 commit e0dabe7

13 files changed

+28
-125
lines changed

azure-pipelines.yml

Lines changed: 14 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -48,163 +48,54 @@ jobs:
4848
name: output
4949
displayName: 'Determine type of code change'
5050
51-
- template: azure-pipelines-steps.yml
52-
parameters:
53-
versions: ['3.6']
54-
images: ['ubuntu-18.04']
55-
package: '-e .[all]'
56-
job:
57-
job: 'Docs'
58-
displayName: 'Build documentation'
59-
dependsOn: 'EvalChanges'
60-
condition: eq(dependencies.EvalChanges.outputs['output.buildDocs'], 'True')
61-
steps:
62-
- script: 'sudo apt-get -yq install graphviz'
63-
displayName: 'Install graphviz'
64-
65-
- script: 'pip install sklearn-contrib-lightning'
66-
displayName: 'Install lightning'
67-
68-
- script: 'pip install git+https://github.com/slundberg/shap.git@d1d2700acc0259f211934373826d5ff71ad514de'
69-
displayName: 'Install specific version of shap'
70-
71-
- script: 'pip install "sphinx < 3.2" sphinx_rtd_theme'
72-
displayName: 'Install sphinx'
73-
74-
- script: 'python setup.py build_sphinx -W'
75-
displayName: 'Build documentation'
76-
77-
- publish: 'build/sphinx/html'
78-
artifact: 'Documentation'
79-
displayName: 'Publish documentation as artifact'
80-
81-
- script: 'python setup.py build_sphinx -b doctest'
82-
displayName: 'Run doctests'
83-
8451
- template: azure-pipelines-steps.yml
8552
parameters:
8653
versions: ['3.8']
8754
images: ['ubuntu-18.04']
88-
package: '-e .[tf]'
89-
job:
90-
job: 'Notebooks'
91-
dependsOn: 'EvalChanges'
92-
condition: eq(dependencies.EvalChanges.outputs['output.buildNbs'], 'True')
93-
steps:
94-
# Work around https://github.com/pypa/pip/issues/9542
95-
- script: 'pip install -U numpy'
96-
displayName: 'Upgrade numpy'
97-
98-
- script: 'pip install pytest-runner && python setup.py pytest'
99-
displayName: 'Unit tests'
100-
env:
101-
PYTEST_ADDOPTS: '-m "notebook"'
102-
103-
- task: PublishTestResults@2
104-
displayName: 'Publish Test Results **/test-results.xml'
105-
inputs:
106-
testResultsFiles: '**/test-results.xml'
107-
testRunTitle: 'Notebooks'
108-
condition: succeededOrFailed()
109-
110-
# - job: 'AutoML'
111-
# dependsOn: 'EvalChanges'
112-
# condition: eq(dependencies.EvalChanges.outputs['output.testCode'], 'True')
113-
# variables:
114-
# python.version: '3.6'
115-
# pool:
116-
# vmImage: 'ubuntu-18.04'
117-
# steps:
118-
# - template: azure-pipelines-steps.yml
119-
# parameters:
120-
# body:
121-
# - task: AzureCLI@2
122-
# displayName: 'AutoML tests'
123-
# inputs:
124-
# azureSubscription: 'automl'
125-
# scriptLocation: 'inlineScript'
126-
# scriptType: 'pscore'
127-
# powerShellIgnoreLASTEXITCODE: '' # string for now due to https://github.com/microsoft/azure-pipelines-tasks/issues/12266
128-
# inlineScript: |
129-
# $env:SUBSCRIPTION_ID = az account show --query id -o tsv
130-
# python setup.py pytest
131-
# env:
132-
# WORKSPACE_NAME: 'testWorkspace'
133-
# RESOURCE_GROUP: 'testingAutoMLEconML'
134-
# PYTEST_ADDOPTS: '-m "automl" -n 0'
135-
# COVERAGE_PROCESS_START: 'setup.cfg'
136-
137-
# - task: PublishTestResults@2
138-
# displayName: 'Publish Test Results **/test-results.xml'
139-
# inputs:
140-
# testResultsFiles: '**/test-results.xml'
141-
# testRunTitle: 'AutoML'
142-
# condition: succeededOrFailed()
143-
# package: '.[automl]'
144-
145-
- template: azure-pipelines-steps.yml
146-
parameters:
147-
versions: ['3.8']
148-
images: ['macOS-10.15']
149-
job:
150-
job: 'Linting'
151-
dependsOn: 'EvalChanges'
152-
condition: eq(dependencies.EvalChanges.outputs['output.testCode'], 'True')
153-
steps:
154-
- script: 'pip install pycodestyle && pycodestyle econml'
155-
failOnStderr: true
156-
displayName: Linting
157-
158-
- template: azure-pipelines-steps.yml
159-
parameters:
16055
package: '-e .[tf,plt]'
16156
job:
16257
job: Tests_no_dml
16358
dependsOn: 'EvalChanges'
16459
condition: eq(dependencies.EvalChanges.outputs['output.testCode'], 'True')
16560
displayName: 'Run tests (non-DML)'
16661
steps:
167-
- script: 'pip install pytest-runner && python setup.py pytest'
62+
- script: 'pip install pytest-runner filprofiler && fil-profile run setup.py pytest'
16863
displayName: 'Unit tests'
16964
env:
170-
PYTEST_ADDOPTS: '-m "not (notebook or automl or dml)"'
65+
PYTEST_ADDOPTS: '-m "not (notebook or automl or dml or half)"'
17166
COVERAGE_PROCESS_START: 'setup.cfg'
17267
- task: PublishTestResults@2
17368
displayName: 'Publish Test Results **/test-results.xml'
17469
inputs:
17570
testResultsFiles: '**/test-results.xml'
17671
testRunTitle: 'Python $(python.version), image $(imageName)'
17772
condition: succeededOrFailed()
178-
179-
- task: PublishCodeCoverageResults@1
180-
displayName: 'Publish Code Coverage Results'
181-
inputs:
182-
codeCoverageTool: Cobertura
183-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
73+
- publish: 'fil-result'
74+
artifact: 'Profiling'
75+
displayName: 'Publish profiling results as artifact'
18476

18577
- template: azure-pipelines-steps.yml
18678
parameters:
79+
versions: ['3.8']
80+
images: ['ubuntu-18.04']
18781
package: '-e .[tf,plt]'
18882
job:
189-
job: Tests_dml
83+
job: Tests_no_dml
19084
dependsOn: 'EvalChanges'
19185
condition: eq(dependencies.EvalChanges.outputs['output.testCode'], 'True')
192-
displayName: 'Run tests (DML)'
86+
displayName: 'Run tests (non-DML)'
19387
steps:
194-
- script: 'pip install pytest-runner && python setup.py pytest'
88+
- script: 'pip install pytest-runner filprofiler && fil-profile run setup.py pytest'
19589
displayName: 'Unit tests'
19690
env:
197-
PYTEST_ADDOPTS: '-m "dml and (not (notebook or automl))"'
91+
PYTEST_ADDOPTS: '-m "half and (not (notebook or automl or dml))"'
19892
COVERAGE_PROCESS_START: 'setup.cfg'
19993
- task: PublishTestResults@2
20094
displayName: 'Publish Test Results **/test-results.xml'
20195
inputs:
20296
testResultsFiles: '**/test-results.xml'
20397
testRunTitle: 'Python $(python.version), image $(imageName)'
20498
condition: succeededOrFailed()
205-
206-
- task: PublishCodeCoverageResults@1
207-
displayName: 'Publish Code Coverage Results'
208-
inputs:
209-
codeCoverageTool: Cobertura
210-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
99+
- publish: 'fil-result'
100+
artifact: 'Profiling'
101+
displayName: 'Publish profiling results as artifact'

econml/tests/test_ate_inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from econml.inference import BootstrapInference
1010

1111

12+
@pytest.mark.half
1213
class TestATEInference(unittest.TestCase):
1314

1415
@classmethod

econml/tests/test_bootstrap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import joblib
1414

1515

16+
@pytest.mark.half
1617
class TestBootstrap(unittest.TestCase):
1718

1819
def test_with_sklearn(self):

econml/tests/test_dowhy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from sklearn.linear_model import LinearRegression, LogisticRegression, Lasso
1212

1313

14+
@pytest.mark.half
1415
class TestDowhy(unittest.TestCase):
1516

1617
def _get_data(self):

econml/tests/test_drlearner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import econml.tests.utilities # bugfix for assertWarns
2525

2626

27+
@pytest.mark.half
2728
class TestDRLearner(unittest.TestCase):
2829

2930
@classmethod

econml/tests/test_linear_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from sklearn.base import clone
1717

1818

19+
@pytest.mark.half
1920
class TestLassoExtensions(unittest.TestCase):
2021
"""Test WeightedLasso."""
2122

econml/tests/test_montecarlo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import numpy as np
1313

1414

15+
@pytest.mark.half
1516
class TestMonteCarlo(unittest.TestCase):
1617

1718
def test_montecarlo(self):

econml/tests/test_orf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from econml.sklearn_extensions.linear_model import WeightedLassoCVWrapper
1515

1616

17+
@pytest.mark.half
1718
class TestOrthoForest(unittest.TestCase):
1819

1920
@classmethod

econml/tests/test_ortho_learner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pytest
1313

1414

15+
@pytest.mark.half
1516
class TestOrthoLearner(unittest.TestCase):
1617

1718
def test_crossfit(self):

econml/tests/test_rscorer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _fit_model(name, model, Y, T, X):
1919
return name, model.fit(Y, T, X=X)
2020

2121

22+
@pytest.mark.half
2223
class TestRScorer(unittest.TestCase):
2324

2425
def _get_data(self):

econml/tests/test_statsmodels.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from sklearn.preprocessing import PolynomialFeatures
2222

2323

24+
@pytest.mark.half
2425
class StatsModelsOLS:
2526
"""
2627
Helper class to wrap a StatsModels OLS model to conform to the sklearn API.

econml/tests/test_two_stage_least_squares.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from sklearn.preprocessing import PolynomialFeatures
1515

1616

17+
@pytest.mark.half
1718
class Test2SLS(unittest.TestCase):
1819

1920
def test_hermite_shape(self):

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ requires = [
99
build-backend = "setuptools.build_meta"
1010

1111
[tool.pytest.ini_options]
12-
addopts = "--junitxml=junit/test-results.xml -n auto --strict-markers --cov-config=setup.cfg --cov=econml --cov-report=xml"
12+
addopts = "--junitxml=junit/test-results.xml --strict-markers"
1313
markers = [
1414
"slow",
1515
"notebook",
1616
"automl",
17-
"dml"
17+
"dml",
18+
"half"
1819
]

0 commit comments

Comments
 (0)