Skip to content

Commit 7a9678a

Browse files
authored
add pickling support for Pipeline (#110)
1 parent 9f63ea7 commit 7a9678a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pdal/PyPipeline.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ const PointViewSet& PipelineExecutor::views() const
100100

101101
std::string PipelineExecutor::getPipeline() const
102102
{
103-
if (!m_executed)
104-
throw pdal_error("Pipeline has not been executed!");
105-
106103
std::stringstream strm;
107104
pdal::PipelineWriter::writePipeline(m_manager.getStage(), strm);
108105
return strm.str();

pdal/pipeline.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def __init__(
3838
self.inputs = arrays
3939
self.loglevel = loglevel
4040

41+
def __getstate__(self):
42+
state = self.pipeline
43+
return state
44+
45+
def __setstate__(self, state):
46+
self.__init__(state)
47+
4148
@property
4249
def stages(self) -> List[Stage]:
4350
return list(self._stages)

test/test_pipeline.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ def test_schema(self, filename):
132132
def test_pipeline(self, filename):
133133
"""Can we fetch PDAL pipeline string"""
134134
r = get_pipeline(filename)
135-
with pytest.raises(RuntimeError) as info:
136-
r.pipeline
137-
assert "Pipeline has not been executed" in str(info.value)
138-
139135
r.execute()
140136
assert json.loads(r.pipeline) == {
141137
"pipeline": [

0 commit comments

Comments
 (0)