def grid_status(subject, argv): if not HubController.is_running(): ok("Grid is not running") sys.exit(1) grid = HubController.get_status() ok("GridIP: " + grid['Ip'] + ' Firefox Nodes: ' + str(grid['firefox_count']) + ' PhantomJS Nodes: ' + str(grid['phantomjs_count']) + ' Chrome Nodes: ' + str(grid['chrome_count']))
def start(subject, argv): if HubController.is_running(): warning("Hub already running") sys.exit(1) info("Starting up grid...") status = HubController.start() if not status: fail("Hub failed to start") sys.exit(1) ok("Hub is Ready!")
def grid_status(subject, argv): if not HubController.is_running(): ok("Grid is not running") sys.exit(1) grid = HubController.get_status() ok( "GridIP: " + grid["Ip"] + " Firefox Nodes: " + str(grid["firefox_count"]) + " PhantomJS Nodes: " + str(grid["phantomjs_count"]) + " Chrome Nodes: " + str(grid["chrome_count"]) )
def nodes(subject, argv): if len(argv) == 0: fail("Missing node action") action = argv.pop(0) if action == 'add': if len(argv) == 0: fail("Missing browser, use phantomjs|firefox|chrome") browser = argv.pop(0) if not HubController.is_valid_browser(browser): fail("Invalid browser please use phantomjs|firefox|chrome") info("Adding node...") status = HubController.add(browser) if not status: fail("Failed to start node") ok("Node Added Successfully!") elif action == 'stop': info("Stopping nodes...") HubController.stop_nodes() ok("Nodes stopped") elif action == 'restart': info("Restarting nodes...") browser = None if len(argv) == 1 and not HubController.is_valid_browser(argv.pop(0)): fail( 'Restarting by browser requires either phantomjs, chrome or firefox' ) HubController.restart_nodes(browser) ok("Nodes restarted") elif action == 'rebuild': # TODO: print "Rebuild Nodes optional by browser" else: fail("Unknown node action: " + action)
def nodes(subject, argv): if len(argv) == 0: fail("Missing node action") action = argv.pop(0) if action == "add": if len(argv) == 0: fail("Missing browser, use phantomjs|firefox|chrome") browser = argv.pop(0) if not HubController.is_valid_browser(browser): fail("Invalid browser please use phantomjs|firefox|chrome") info("Adding node...") status = HubController.add(browser) if not status: fail("Failed to start node") ok("Node Added Successfully!") elif action == "stop": info("Stopping nodes...") HubController.stop_nodes() ok("Nodes stopped") elif action == "restart": info("Restarting nodes...") browser = None if len(argv) == 1 and not HubController.is_valid_browser(argv.pop(0)): fail("Restarting by browser requires either phantomjs, chrome or firefox") HubController.restart_nodes(browser) ok("Nodes restarted") elif action == "rebuild": # TODO: print "Rebuild Nodes optional by browser" else: fail("Unknown node action: " + action)
def shutdown(subject, argv): if not HubController.is_running(): fail("Hub is not running") sys.exit(1) info("Shutting down grid...") HubController.shutdown()
def grid_status(subject, argv): if not HubController.is_running(): ok("Grid is not running") sys.exit(1) grid = HubController.get_status() ok("GridIP: " + grid['Ip'] + ' Firefox Nodes: ' + str(grid['firefox_count']) + ' PhantomJS Nodes: ' + str(grid['phantomjs_count']))