Beispiel #1
0
def main():
    """Runs the scheduler for one process, and the worker for all other processes."""
    prepare.set_global_variables()
    if tools.MPI.rank() == global_vars.SCHEDULER_PROC:
        scheduler.main()
    else:
        worker.main()
Beispiel #2
0
 def SvcDoRun(self):
     
     os.chdir(os.path.dirname(__file__))
     
     #s = Server(None)
     #s.run([self.iniFile])
     #jobscheduler.main()
     #win32event.SetEvent(self.start_event)
     
     main()
     win32event.WaitForSingleObject(self.stop_event, win32event.INFINITE)
Beispiel #3
0
 def run(self):
     s.main()
     self.exit()
from scheduler import main

if __name__ == '__main__':
    main()
def schedule():
    data = request.json
    return scheduler.main(data)
Beispiel #6
0
 def run(self):
     s.main()
     self.exit()
Beispiel #7
0
    def test_main(self, mock_run, mock_LoopingCall):
        main()

        mock_LoopingCall.assert_called_with(run_crawler)
        mock_LoopingCall().start.assert_called_with(LOOP_IN_SECONDS)
        mock_run.assert_called_once()
Beispiel #8
0
        result = None
        try:
            # Find request to delete
            for req in requests:
                if req['request_id'] == int(request_id):
                    result = req
            # Delete request
            if result:
                requests.remove(result)
                output_file = open(file_path + '/../data/requests.json', 'w')
                json.dump(requests, output_file)
                output_file.close()
            # No request found
            else:
                return "Error: No requests found with that request_id. Please enter a valid request_id.", 404
        except:
            return {'message': 'Invalid request data provided'}, 400

# Homepage
api.add_resource(EmployeeList, '/api/v1/employees')
api.add_resource(Employee, '/api/v1/employees/<employee_id>')

api.add_resource(APIKeys, '/api/v1/keys')
api.add_resource(APIKey, '/api/v1/keys/<api_key_id>')
api.add_resource(Locations, '/api/v1/locations')
api.add_resource(Location, '/api/v1/locations/<location_id>')
api.add_resource(Requests, '/api/v1/requests')
api.add_resource(Request, '/api/v1/requests/<request_id>')
app.run()
scheduler.main()