Skip to content

Commit dd237bf

Browse files
authored
update pyrosetta_documentation release-test script (#517)
* Add documentation for `__init__` methods * Add documentation generation for PyRosetta Distributed framework
1 parent df75a9c commit dd237bf

File tree

11 files changed

+74
-61
lines changed

11 files changed

+74
-61
lines changed

source/src/python/PyRosetta/documentation/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,12 @@
354354
# If true, do not generate a @detailmenu in the "Top" node's menu.
355355
#
356356
# texinfo_no_detailmenu = False
357+
358+
# https://stackoverflow.com/a/61732050
359+
autodoc_default_options = {
360+
'members': True,
361+
'member-order': 'bysource',
362+
'special-members': '__init__',
363+
'undoc-members': True,
364+
'exclude-members': '__weakref__'
365+
}

source/src/python/PyRosetta/src/pyrosetta/tests/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
import pyrosetta.tests
1111

12-
result = pyrosetta.tests.test()
13-
sys.exit(not result.wasSuccessful())
12+
# result = pyrosetta.tests.test()
13+
# sys.exit(not result.wasSuccessful())

source/src/python/PyRosetta/src/pyrosetta/tests/bindings/core/test_pose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,5 +1000,5 @@ def test_poses_to_silent(self):
10001000
msg="List position recovery failed.")
10011001

10021002

1003-
if __name__ == "__main__":
1004-
unittest.main()
1003+
# if __name__ == "__main__":
1004+
# unittest.main()

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/print_discovered_test_cases.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def main(root):
2121
test_cases = (test_case.id() for test_case in flatten(suite))
2222
print(*test_cases, sep="\n")
2323

24-
if __name__ == "__main__":
25-
parser = argparse.ArgumentParser()
26-
parser.add_argument("--root", type=str, default=os.curdir, help="Root directory path (Default: '.')")
27-
args = parser.parse_args()
28-
main(args.root)
24+
# if __name__ == "__main__":
25+
# parser = argparse.ArgumentParser()
26+
# parser.add_argument("--root", type=str, default=os.curdir, help="Root directory path (Default: '.')")
27+
# args = parser.parse_args()
28+
# main(args.root)

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/skip_cloudpickle_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ def main():
3434
print("Caught AttributeError in cloudpickle version {0} trying to pickle a Pose object: {1}".format(version, ex))
3535
sys.exit(1)
3636

37-
if __name__ == "__main__":
38-
print("Running: {0}".format(__file__))
39-
main()
37+
# if __name__ == "__main__":
38+
# print("Running: {0}".format(__file__))
39+
# main()

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/skip_command_line_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ def my_pyrosetta_protocol_2(packed_pose, **kwargs):
6262
).distribute(protocols=[my_pyrosetta_protocol, my_pyrosetta_protocol_2])
6363

6464

65-
if __name__ == "__main__":
66-
unittest.main(verbosity=2)
65+
# if __name__ == "__main__":
66+
# unittest.main(verbosity=2)

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/test_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,5 @@ def my_pyrosetta_protocol_2(packed_pose, **kwargs):
199199
self.assertIn(expected_msg, warning_msgs)
200200

201201

202-
if __name__ == "__main__":
203-
unittest.main(verbosity=2)
202+
# if __name__ == "__main__":
203+
# unittest.main(verbosity=2)

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/test_reproducibility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,5 +1057,5 @@ def test_reproducibility_from_reproduce_filter_results(self):
10571057
return self.test_reproducibility_from_reproduce(filter_results=True)
10581058

10591059

1060-
if __name__ == "__main__":
1061-
unittest.main(verbosity=2)
1060+
# if __name__ == "__main__":
1061+
# unittest.main(verbosity=2)

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/cluster/test_smoke.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -923,12 +923,12 @@ def test_clients(self):
923923
client_1 = Client(cluster_1)
924924
client_1_repr = repr(client_1)
925925

926-
client_2 = Client(cluster_2)
926+
client_2 = Client(cluster_2)
927927
client_2_repr = repr(client_2)
928928

929929
clients = [client_1, client_2]
930930
clients_indices = [0, 1, 1, 0]
931-
931+
932932
def create_tasks(client_1_repr=client_1_repr, client_2_repr=client_2_repr):
933933
for _ in range(1, 3):
934934
yield {
@@ -951,7 +951,7 @@ def my_pyrosetta_protocol_1(packed_pose, **kwargs):
951951
self.assertEqual(_client_repr, _client_2_repr)
952952
self.assertNotEqual(_client_repr, _client_1_repr)
953953
self.assertNotIn(_protocol_number, (1, 3))
954-
954+
955955
def my_pyrosetta_protocol_2(packed_pose, **kwargs):
956956
_client_repr = kwargs["PyRosettaCluster_client_repr"]
957957
_protocol_number = kwargs["PyRosettaCluster_protocol_number"]
@@ -965,14 +965,14 @@ def my_pyrosetta_protocol_2(packed_pose, **kwargs):
965965
self.assertEqual(_client_repr, _client_1_repr)
966966
self.assertNotEqual(_client_repr, _client_2_repr)
967967
self.assertNotIn(_protocol_number, (0, 2))
968-
968+
969969
protocols = [
970970
my_pyrosetta_protocol_1,
971971
my_pyrosetta_protocol_2,
972972
my_pyrosetta_protocol_1,
973973
my_pyrosetta_protocol_2,
974974
]
975-
975+
976976
instance_kwargs = dict(
977977
tasks=create_tasks,
978978
input_packed_pose=io.pose_from_sequence("TESTING"),
@@ -1044,20 +1044,20 @@ def test_resources(self):
10441044
resources={"foo": 1, "bar": 2, "baz": 3},
10451045
)
10461046
client = Client(cluster)
1047-
1047+
10481048
def create_tasks():
10491049
for _ in range(1, 4):
10501050
yield {
10511051
"extra_options": "-ex1 -multithreading:total_threads 1",
10521052
"set_logging_handler": "logging",
10531053
}
10541054

1055-
def my_pyrosetta_protocol_1(packed_pose, **kwargs):
1055+
def my_pyrosetta_protocol_1(packed_pose, **kwargs):
10561056
return packed_pose.update_scores(sequence=packed_pose.pose.sequence())
1057-
1057+
10581058
def my_pyrosetta_protocol_2(packed_pose, **kwargs):
10591059
return packed_pose
1060-
1060+
10611061
protocols = [
10621062
my_pyrosetta_protocol_1,
10631063
my_pyrosetta_protocol_2,
@@ -1152,12 +1152,12 @@ def test_resources_clients(self):
11521152
client_1 = Client(cluster_1)
11531153
client_1_repr = repr(client_1)
11541154

1155-
client_2 = Client(cluster_2)
1155+
client_2 = Client(cluster_2)
11561156
client_2_repr = repr(client_2)
11571157

11581158
clients = [client_1, client_2]
11591159
clients_indices = [0, 1]
1160-
1160+
11611161
def create_tasks(client_1_repr=client_1_repr, client_2_repr=client_2_repr):
11621162
for _ in range(1, 4):
11631163
yield {
@@ -1178,7 +1178,7 @@ def my_pyrosetta_protocol_1(packed_pose, **kwargs):
11781178
self.assertNotEqual(_client_repr, _client_2_repr)
11791179

11801180
return packed_pose.update_scores(sequence=packed_pose.pose.sequence())
1181-
1181+
11821182
def my_pyrosetta_protocol_2(packed_pose, **kwargs):
11831183
_client_repr = kwargs["PyRosettaCluster_client_repr"]
11841184
_protocol_number = kwargs["PyRosettaCluster_protocol_number"]
@@ -1190,7 +1190,7 @@ def my_pyrosetta_protocol_2(packed_pose, **kwargs):
11901190
self.assertNotEqual(_client_repr, _client_1_repr)
11911191

11921192
return packed_pose
1193-
1193+
11941194
protocols = [my_pyrosetta_protocol_1, my_pyrosetta_protocol_2]
11951195
resources = [{"FOO": 1}, {"BAR": 9e8}]
11961196
output_path = os.path.join(workdir, "outputs")
@@ -1951,5 +1951,5 @@ def test_timing_multi_instance(self):
19511951
self.tear_down_logger(_logger, _stream_handler)
19521952

19531953

1954-
if __name__ == "__main__":
1955-
unittest.main(verbosity=2)
1954+
# if __name__ == "__main__":
1955+
# unittest.main(verbosity=2)

source/src/python/PyRosetta/src/pyrosetta/tests/distributed/test_dask.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
@unittest.skipIf(__dask_version__ is None, "Skipping because 'dask' version is undetermined.")
2525
class TestDaskDistribution(unittest.TestCase):
26-
26+
2727
_dask_scheduler = None
28-
28+
2929
with tempfile.TemporaryDirectory() as workdir:
30-
30+
3131
def setUp(self, local_dir=workdir):
3232
if not self._dask_scheduler:
3333
n_workers = 2
@@ -56,7 +56,7 @@ def setUp(self, local_dir=workdir):
5656

5757
def tearDown(self):
5858
self.client.close()
59-
59+
6060
if self.local_cluster:
6161
self.local_cluster.close()
6262

@@ -92,22 +92,22 @@ def test_basic(self):
9292
self.assertEqual(task.result(), 2)
9393

9494

95-
if __name__ == "__main__":
96-
97-
logging.basicConfig(
98-
level=logging.INFO,
99-
format="%(asctime)s.%(msecs).03d %(name)s %(message)s",
100-
datefmt='%Y-%m-%dT%H:%M:%S'
101-
)
102-
103-
parser = argparse.ArgumentParser(
104-
description="Run initial pyrosetta.distributed smoke test over given scheduler."
105-
)
106-
parser.add_argument("scheduler", type=str, nargs="?", help="Target scheduler endpoint for test.")
107-
args = parser.parse_args()
108-
109-
TestDaskDistribution._dask_scheduler = args.scheduler
110-
111-
test_suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestDaskDistribution)
112-
runner = unittest.TextTestRunner()
113-
runner.run(test_suite)
95+
# if __name__ == "__main__":
96+
#
97+
# logging.basicConfig(
98+
# level=logging.INFO,
99+
# format="%(asctime)s.%(msecs).03d %(name)s %(message)s",
100+
# datefmt='%Y-%m-%dT%H:%M:%S'
101+
# )
102+
#
103+
# parser = argparse.ArgumentParser(
104+
# description="Run initial pyrosetta.distributed smoke test over given scheduler."
105+
# )
106+
# parser.add_argument("scheduler", type=str, nargs="?", help="Target scheduler endpoint for test.")
107+
# args = parser.parse_args()
108+
#
109+
# TestDaskDistribution._dask_scheduler = args.scheduler
110+
#
111+
# test_suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestDaskDistribution)
112+
# runner = unittest.TextTestRunner()
113+
# runner.run(test_suite)

0 commit comments

Comments
 (0)