You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO Why managing previous and predecessors per separate?
## Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with# this work for additional information regarding copyright ownership.# The ASF licenses this file to You under the Apache License, Version 2.0# (the "License"); you may not use this file except in compliance with# the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.#importpickleimportcloudpicklefrompywy.config.config_readerimportget_source_typesfrompywy.config.config_readerimportget_sink_typesfrompywy.config.config_readerimportget_boundary_typesimportloggingpickle_protocol=pickle.HIGHEST_PROTOCOL# Describes an Operation over an intermediate result# Each operation could be processed by Python or Java platformsclassOperator:
def__init__(
self, operator_type=None, udf=None, previous=None,
iterator=None, python_exec=False
):
# Operator IDself.id=id(self)
# Operator Typeself.operator_type=operator_type# Set Boundariesifself.operator_typeinget_boundary_types():
self.boundary=Trueelse:
self.boundary=False# UDF Functionself.udf=udf# Source types must come with an Iteratorself.iterator=iteratorifoperator_typeinget_source_types():
ifiteratorisNone:
print("Source Operator Type without an Iterator")
raiseelse:
self.source=Trueelse:
self.source=False# Sink Operatorsifoperator_typeinget_sink_types():
self.sink=Trueelse:
self.sink=False# TODO Why managing previous and predecessors per separate?self.previous=previousself.successor= []
self.predecessor= []
self.parameters= {}
# Set predecessors and successors from previousifself.previous:
forprevinself.previous:
ifprevisnotNone:
prev.set_successor(self)
self.set_predecessor(prev)
self.python_exec=python_execlogging.info("Operator:"+str(self.getID()) +", type:"+self.operator_type+", PythonExecutable: "+str(self.python_exec) +", is boundary: "+str(self.is_boundary()) +", is source: "+str(self.source) +", is sink: "+str(self.sink))
defgetID(self):
returnself.iddefis_source(self):
returnself.sourcedefis_sink(self):
returnself.sinkdefis_boundary(self):
returnself.boundarydefserialize_udf(self):
self.udf=cloudpickle.dumps(self.udf)
defgetIterator(self):
ifself.is_source():
returnself.iterator# TODO this should iterate through previous REDESIGNreturnself.udf(self.previous[0].getIterator())
defset_parameter(self, key, value):
self.parameters[key] =valuedefset_successor(self, suc):
if (notself.is_sink()) andself.successor.count(suc) ==0:
self.successor.append(suc)
defset_predecessor(self, suc):
ifself.predecessor.count(suc) ==0:
self.predecessor.append(suc)
ea17eb1209cadc4bb2dbe95f752590de9723a51d
The text was updated successfully, but these errors were encountered:
Why managing previous and predecessors per separate?
incubator-wayang/python/old_code/pywayang/src/pywy/orchestrator/operator.py
Line 69 in c25c656
ea17eb1209cadc4bb2dbe95f752590de9723a51d
The text was updated successfully, but these errors were encountered: