# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# class ActorException(Exception):   #NOTE: Overview documented
#     def __init__(self, *argv, **argd):
#         super(ActorException, self).__init__(*argv)
#         self.__dict__.update(argd)


from functools import wraps as _wraps
from contextlib import contextmanager
from guild.actor import Actor, ActorException
import copy
import threading
import time
import time
#!/usr/bin/python
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
#     http://www.kamaelia.org/AUTHORS - please extend this file,
#     not this notice.
#
# Licensed 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.
# -------------------------------------------------------------------------

from __future__ import print_function




class MaxRetriesExceeded(ActorException):
    pass



# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# class ActorException(Exception):   #NOTE: Overview documented
#     def __init__(self, *argv, **argd):
#         super(ActorException, self).__init__(*argv)
#         self.__dict__.update(argd)


# Path: guild/stm.py
from functools import wraps as _wraps
from contextlib import contextmanager
from guild.actor import Actor, ActorException
import copy
import threading
import time
import time

#!/usr/bin/python
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
#     http://www.kamaelia.org/AUTHORS - please extend this file,
#     not this notice.
#
# Licensed 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.
# -------------------------------------------------------------------------

from __future__ import print_function




class MaxRetriesExceeded(ActorException):
    pass



class RetryTimeoutExceeded(ActorException):