Skip to content

Commit 5373fc3

Browse files
Added docs using RST format for datamodel XY and XYRef, all tests pass.. this still needs examples
1 parent 6506ada commit 5373fc3

File tree

2 files changed

+58
-15
lines changed

2 files changed

+58
-15
lines changed

codeflare/pipelines/Datamodel.py

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,38 @@
99
import pickle5 as pickle
1010
import codeflare.pipelines.Exceptions as pe
1111

12+
1213
class Xy:
1314
"""
1415
Holder class for Xy, where X is array-like and y is array-like. This is the base
1516
data structure for fully materialized X and y.
1617
"""
1718

1819
def __init__(self, X, y):
20+
"""
21+
Init this instance with the given X and y, X and y shapes are assumed to
22+
be consistent.
23+
24+
:param X: Array-like X
25+
:param y: Array-like y
26+
"""
1927
self.__X__ = X
2028
self.__y__ = y
2129

22-
"""
23-
Returns the holder value of X
24-
"""
25-
2630
def get_x(self):
27-
return self.__X__
31+
"""
32+
Getter for X
2833
29-
"""
30-
Returns the holder value of y
31-
"""
34+
:return: Holder value of X
35+
"""
36+
return self.__X__
3237

3338
def get_y(self):
39+
"""
40+
Getter for y
41+
42+
:return: Holder value of y
43+
"""
3444
return self.__y__
3545

3646

@@ -40,34 +50,66 @@ class XYRef:
4050
a holder to the object references of Ray. This is used for passing outputs from a transform/fit
4151
to the next stage of the pipeline. Since the references can be potentially in flight (or being
4252
computed), these holders are essential to the pipeline constructs.
53+
54+
It also holds the state of the node itself, with the previous state of the node before a transform
55+
operation is applied being held along with the next state. It also holds the previous
56+
XYRef instances. In essence, this holder class is a bunch of pointers, but it is enough to reconstruct
57+
the entire pipeline through appropriate traversals.
4358
"""
4459

45-
def __init__(self, Xref, yref, prev_node_state_ref=None, curr_node_state_ref=None, prev_Xyrefs = None):
60+
def __init__(self, Xref: ray.ObjectRef, yref: ray.ObjectRef, prev_node_state_ref: ray.ObjectRef=None, curr_node_state_ref: ray.ObjectRef=None, prev_Xyrefs = None):
61+
"""
62+
Init, default is only references to X and y as object references
63+
:param Xref: ObjectRef to X
64+
:param yref: ObjectRef to y
65+
:param prev_node_state_ref: ObjectRef to previous node state, default is None
66+
:param curr_node_state_ref: ObjectRef to current node state, default in None
67+
:param prev_Xyrefs: List of XYrefs
68+
"""
4669
self.__Xref__ = Xref
4770
self.__yref__ = yref
4871
self.__prev_node_state_ref__ = prev_node_state_ref
4972
self.__curr_node_state_ref__ = curr_node_state_ref
5073
self.__prev_Xyrefs__ = prev_Xyrefs
5174

52-
def get_Xref(self):
75+
def get_Xref(self) -> ray.ObjectRef:
5376
"""
54-
Returns the object reference to X
77+
Getter for the reference to X
78+
79+
:return: ObjectRef to X
5580
"""
5681
return self.__Xref__
5782

58-
def get_yref(self):
83+
def get_yref(self) -> ray.ObjectRef:
5984
"""
60-
Returns the object reference to y
85+
Getter for the reference to y
86+
87+
:return: ObjectRef to y
6188
"""
6289
return self.__yref__
6390

64-
def get_prev_node_state_ref(self):
91+
def get_prev_node_state_ref(self) -> ray.ObjectRef:
92+
"""
93+
Getter for the reference to previous node state
94+
95+
:return: ObjectRef to previous node state
96+
"""
6597
return self.__prev_node_state_ref__
6698

67-
def get_curr_node_state_ref(self):
99+
def get_curr_node_state_ref(self) -> ray.ObjectRef:
100+
"""
101+
Getter for the reference to current node state
102+
103+
:return: ObjectRef to current node state
104+
"""
68105
return self.__curr_node_state_ref__
69106

70107
def get_prev_xyrefs(self):
108+
"""
109+
Getter for the list of previous XYrefs
110+
111+
:return: List of XYRefs
112+
"""
71113
return self.__prev_Xyrefs__
72114

73115

codeflare_pipelines.egg-info/SOURCES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ codeflare/pipelines/Datamodel.py
55
codeflare/pipelines/Exceptions.py
66
codeflare/pipelines/Runtime.py
77
codeflare/pipelines/__init__.py
8+
codeflare/pipelines/test_Datamodel.py
89
codeflare_pipelines.egg-info/PKG-INFO
910
codeflare_pipelines.egg-info/SOURCES.txt
1011
codeflare_pipelines.egg-info/dependency_links.txt

0 commit comments

Comments
 (0)