def run(): parser = argparse.ArgumentParser(description='Painless code deployment.') parser.add_argument('command', metavar='cmd', help='The command to execute.', choices=['init', 'now']) args = parser.parse_args() deploy = Deploy(args.command) deploy.execute()
def exec_deploy(self, testname): if self._module is not None: try: d = getattr(self._module.plugin, 'Deploy')(self._config) except AttributeError: d = Deploy(self._config) else: d = Deploy(self._config) d.run(testname) if testname is not None: print 'Successfully deployed the test: ' + testname + '.' else: print 'Successfully deployed the project.'
def main(): current_date = dt.datetime.today().strftime('%m-%d') with open(f'./lib/json/pointers.json', 'r') as model_state: trained_model = json.load(model_state)['paths']['modelPath'] model_state.close() if os.path.isfile(trained_model): deployment = Deploy() deployment.run() else: model_foundations = Build(current_date) model_foundations.run()
def exec_deploy(self, plugin, testname): try: d = Deploy(self._config) d.deploy_project(testname) except: raise if plugin: try: plugin.after_deploy(testname) except AttributeError: pass if testname is not None: print 'Successfully deployed the test: ' + testname + '.' else: print 'Successfully deployed the project.'
def main(): bundle = None for arg in sys.argv: if arg.startswith("--bundle="): bundle = arg.split("=", 1)[1] elif arg == "-h" or arg == "--help": print_help() return if bundle is None: print_help() sys.exit(1) Deploy().deploy(bundle)
def hook_controller(vendor): """Main webhook route""" hook = getattr(hooks, vendor)() app.logger.info('Loading {} webhook data'.format(hook.name)) try: hook.read(request) except Exception as error: app.logger.error('Could not read hook data: {}'.format(error)) return response(success=False, message='Invalid request'), 400 # Check for valid secret if not auth.verify(hook.key): return response(success=False, message='Access denied'), 401 # Run deployments in project directory asynchronously deploy = Deploy(env['PROJECTS_PATH'], app.logger) thread = Thread(target=deploy.run, args=(hook, )) thread.start() return response(success=True, message='Deployment scheduled'), 202
Monitor the path-folder,when there is a new file generated,the IN_Create event will be triggered :param path:the path to be monitored :param deploy:the object if gru-model :return: """ wm = WatchManager() mask = IN_CREATE if deploy is None: logging.error('Model Uninitial!') return notifier = Notifier(wm, EventHandler(predict=deploy)) wm.add_watch(path, mask, auto_add=True, rec=True) print('now starting monitor %s' % (path)) while True: try: notifier.process_events() if notifier.check_events(): notifier.read_events() except KeyboardInterrupt: notifier.stop() break if __name__ == "__main__": config_log() deploy = Deploy("/home/ices/work/gru_tf_rebuild/save/69999") FSMonitor('/tmp/refs', deploy) # file_name='cappi_ref_201502210800_2500_8.ref' # file_dir = '/home/ices/work/deploy' # get_in_refs(file_name,file_dir)
#!/usr/bin/env python import os import sys from deploy import Deploy from console import Console if __name__ == "__main__": if len(sys.argv) < 2: print 'Missing config file location' sys.exit(0) config_path = os.path.abspath(sys.argv[1]) d = Deploy() d.config.read(config_path) try: # deploy branch if len(sys.argv) == 3: d.deploy(sys.argv[2]) # deploy master else: d.deploy() except RuntimeError, e: c = Console() c.error(str(e))
#!/usr/bin/env python # coding=utf-8 from deploy import Deploy if __name__ == '__main__': obj = Deploy("/data/www") obj.deploy(2)
#!/usr/bin/python import os import shutil import sys from deploy import Deploy src = sys.argv[1] dst = sys.argv[2] if os.path.exists(dst): shutil.rmtree(dst) os.mkdir(dst) d = Deploy(src, dst) d.Deploy()
#!/usr/bin/env python # -*- coding: utf-8 -*- from deploy import Deploy import env services = { 'rain-django': { 'image': env.load_env_variable('RAIN_DJANGO_IMAGE'), 'container': 'rain-django', 'opts': ['-v', 'rain-django:/rain-django', '-p', '80:39154'] } } if __name__ == '__main__': deploy = Deploy() deploy.offer_services(services) deploy.main()
#!/usr/bin/env python # coding=utf-8 from deploy import Deploy if __name__ == '__main__': obj = Deploy("/var/www/html") obj.pull()
#!/usr/bin/env python # coding=utf-8 from deploy import Deploy if __name__ == '__main__': obj = Deploy("/var/www/html") obj.deploy(1)
# coding=utf-8 from deploy import Deploy if __name__ == '__main__': obj = Deploy("/data/www/html") print("result", obj.refresh_cdn())
#!/usr/bin/env python import os import sys from deploy import Deploy from console import Console if __name__ == "__main__": if len(sys.argv) < 2: print 'Missing config file location' sys.exit(0) config_path = os.path.abspath(sys.argv[1]) d = Deploy() d.config.read(config_path) try: if len(sys.argv) == 3: d.rollback(sys.argv[2]) else: d.deploy() except RuntimeError, e: c = Console() c.error(str(e))