Updated the TestSink to conform to the new actor definition.
# See the License for the specific language governing permissions and
# limitations under the License.
-from calvin.actor.actor import Actor, ActionResult, manage, condition, guard
+from calvin.actor.actor import Actor, manage, condition, stateguard
from calvin.utilities.calvinlogger import get_logger
_log = get_logger(__name__)
@@ -48,13 +48,12 @@ class TestSink(Actor):
else:
self.logger = _log.info
+ @stateguard(lambda self: self.active)
@condition(action_input=['token'])
- @guard(lambda self, token: self.active)
def log(self, token):
if self.store_tokens:
self.tokens.append(token)
self.logger("%s<%s>: %s" % (self.__class__.__name__, self.id, str(token).strip()))
- return ActionResult()
action_priority = (log, )
