Skip to content

Commit

Permalink
[CI] Reduce CI workload (dmlc#4196)
Browse files Browse the repository at this point in the history
* try optimize CI

* fix go test; adjust timing report

* disable certain tests for mx/tf backends

* fix ut

* add pydantic
  • Loading branch information
jermainewang authored Jun 30, 2022
1 parent 7735473 commit f7dae45
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 67 deletions.
33 changes: 22 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def tutorial_test_linux(backend) {
def go_test_linux() {
init_git()
unpack_lib('dgl-cpu-linux', dgl_linux_libs)
timeout(time: 30, unit: 'MINUTES') {
timeout(time: 20, unit: 'MINUTES') {
sh "bash tests/scripts/task_go_test.sh"
}
}
Expand Down Expand Up @@ -371,11 +371,6 @@ pipeline {
tutorial_test_linux('pytorch')
}
}
stage('DGL-Go CPU test') {
steps {
go_test_linux()
}
}
}
post {
always {
Expand Down Expand Up @@ -445,11 +440,6 @@ pipeline {
unit_test_linux('mxnet', 'cpu')
}
}
//stage("Tutorial test") {
// steps {
// tutorial_test_linux("mxnet")
// }
//}
}
post {
always {
Expand Down Expand Up @@ -480,6 +470,27 @@ pipeline {
}
}
}
stage('DGL-Go') {
agent {
docker {
label "linux-cpu-node"
image "dgllib/dgl-ci-cpu:cu101_v220629"
alwaysPull true
}
}
stages {
stage('DGL-Go CPU test') {
steps {
go_test_linux()
}
}
}
post {
always {
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
}
}
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions tests/compute/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import dgl

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_minigc():
ds = data.MiniGCDataset(16, 10, 20)
g, l = list(zip(*ds))
Expand All @@ -24,6 +25,7 @@ def test_minigc():
assert g2.num_edges() - g1.num_edges() == g1.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_gin():
ds_n_graphs = {
'MUTAG': 188,
Expand All @@ -43,6 +45,7 @@ def test_gin():
assert ds.num_classes == ds.gclasses

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_fraud():
transform = dgl.AddSelfLoop(allow_duplicate=True)

Expand All @@ -66,6 +69,7 @@ def test_fraud():
assert g2.num_edges() - g.num_edges() == g.num_nodes() * 3

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_fakenews():
transform = dgl.AddSelfLoop(allow_duplicate=True)

Expand All @@ -82,6 +86,7 @@ def test_fakenews():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_tudataset_regression():
ds = data.TUDataset('ZINC_test', force_reload=True)
assert ds.num_classes == ds.num_labels
Expand All @@ -94,6 +99,7 @@ def test_tudataset_regression():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_data_hash():
class HashTestDataset(data.DGLDataset):
def __init__(self, hash_key=()):
Expand All @@ -111,6 +117,7 @@ def _load(self):


@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_citation_graph():
transform = dgl.AddSelfLoop(allow_duplicate=True)

Expand Down Expand Up @@ -143,6 +150,7 @@ def test_citation_graph():


@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_gnn_benchmark():
transform = dgl.AddSelfLoop(allow_duplicate=True)

Expand Down Expand Up @@ -193,6 +201,7 @@ def test_gnn_benchmark():


@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_reddit():
# RedditDataset
g = data.RedditDataset()[0]
Expand All @@ -206,6 +215,7 @@ def test_reddit():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_explain_syn():
dataset = data.BAShapeDataset()
assert dataset.num_classes == 4
Expand Down Expand Up @@ -265,6 +275,7 @@ def test_explain_syn():
assert 'feat' in g.ndata

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_wiki_cs():
g = data.WikiCSDataset()[0]
assert g.num_nodes() == 11701
Expand All @@ -277,6 +288,7 @@ def test_wiki_cs():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skip(reason="Dataset too large to download for the latest CI.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_yelp():
g = data.YelpDataset(reorder=True)[0]
assert g.num_nodes() == 716847
Expand All @@ -289,6 +301,7 @@ def test_yelp():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_flickr():
g = data.FlickrDataset(reorder=True)[0]
assert g.num_nodes() == 89250
Expand All @@ -301,6 +314,7 @@ def test_flickr():
assert g2.num_edges() - g.num_edges() == g.num_nodes()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_extract_archive():
# gzip
with tempfile.TemporaryDirectory() as src_dir:
Expand Down Expand Up @@ -1256,6 +1270,7 @@ def _test_NodeEdgeGraphData():


@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_csvdataset():
_test_NodeEdgeGraphData()
_test_construct_graphs_node_ids()
Expand All @@ -1272,6 +1287,7 @@ def test_csvdataset():
_test_CSVDataset_customized_data_parser()

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_add_nodepred_split():
dataset = data.AmazonCoBuyComputerDataset()
print('train_mask' in dataset[0].ndata)
Expand All @@ -1284,6 +1300,7 @@ def test_add_nodepred_split():
assert 'train_mask' in dataset[0].nodes['Publikationen'].data

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_nodepred1():
ds = data.AmazonCoBuyComputerDataset()
print('train_mask' in ds[0].ndata)
Expand Down Expand Up @@ -1314,6 +1331,7 @@ def test_as_nodepred1():
new_ds[0].nodes['Personen'].data['test_mask']))

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_nodepred2():
# test proper reprocessing

Expand Down Expand Up @@ -1344,6 +1362,7 @@ def test_as_nodepred2():
assert len(ds.train_idx) == int(ds[0].num_nodes('Personen') * 0.1)

@unittest.skipIf(dgl.backend.backend_name != 'pytorch', reason="ogb only supports pytorch")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_nodepred_ogb():
from ogb.nodeproppred import DglNodePropPredDataset
ds = data.AsNodePredDataset(DglNodePropPredDataset("ogbn-arxiv"), split_ratio=None, verbose=True)
Expand All @@ -1356,6 +1375,7 @@ def test_as_nodepred_ogb():
ds = data.AsNodePredDataset(DglNodePropPredDataset("ogbn-arxiv"), split_ratio=[0.7, 0.2, 0.1], verbose=True)

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_linkpred():
# create
ds = data.AsLinkPredDataset(data.CoraGraphDataset(), split_ratio=[0.8, 0.1, 0.1], neg_ratio=1, verbose=True)
Expand All @@ -1381,6 +1401,7 @@ def test_as_linkpred_ogb():
assert ds.test_edges[0][0].shape[0] == 235812

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_nodepred_csvdataset():
with tempfile.TemporaryDirectory() as test_dir:
# generate YAML/CSVs
Expand Down Expand Up @@ -1423,6 +1444,7 @@ def test_as_nodepred_csvdataset():
assert 'train_mask' in new_ds[0].ndata

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_graphpred():
ds = data.GINDataset(name='MUTAG', self_loop=True)
new_ds = data.AsGraphPredDataset(ds, [0.8, 0.1, 0.1], verbose=True)
Expand Down Expand Up @@ -1473,6 +1495,7 @@ def test_as_graphpred():
assert new_ds.num_classes == 2

@unittest.skipIf(F._default_context_str == 'gpu', reason="Datasets don't need to be tested on GPU.")
@unittest.skipIf(dgl.backend.backend_name == "mxnet", reason="Skip MXNet")
def test_as_graphpred_reprocess():
ds = data.AsGraphPredDataset(data.GINDataset(name='MUTAG', self_loop=True), [0.8, 0.1, 0.1])
assert len(ds.train_idx) == int(len(ds) * 0.8)
Expand Down
Loading

0 comments on commit f7dae45

Please sign in to comment.