def test_revive_dead_workers(self, hgetall, lpush): scheduler.revive_dead_workers() hgetall.assert_called_with("scheduler:params", decode=False) lpush.assert_called_with( "mq:scheduler", '{"contract_id":"banana","seconds":54,"action":"create"}')
# names, trademarks, service marks, or product names of the Licensor # and its affiliates, except as required to comply with Section 4(c) of # the License and to reproduce the content of the NOTICE file. # You may obtain a copy of the Apache License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the Apache License with the above modification is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the Apache License for the specific # language governing permissions and limitations under the Apache License. from dragonchain.scheduler import scheduler from dragonchain.lib import error_reporter from dragonchain import logger _log = logger.get_logger() if __name__ == "__main__": try: # Revive dead workers scheduler.revive_dead_workers() # Await new change requests while True: scheduler.subscribe("mq:scheduler") except Exception as e: error_reporter.report_exception( e, "Uncaught exception in event scheduler") raise