attempts += 1 if not new_task: logging.error( "Unable to retrieve new task from Marathon, there may be a communication failure with Mesos." ) exit_code = 1 sys.exit(exit_code) deployment_id = response.json()["deploymentId"] logging.info("New version created by restart: {}".format( response.json()["version"])) ### Get Framework ID marathon_info = client.get_info() framework_id = marathon_info.framework_id ### Query Mesos API to discover Container ID agent_hostname = new_task.host mesos_agent_map = {} if mesos_agent_map_string: for mapping in mesos_agent_map_string.split(','): mapping = mapping.split('|') mesos_agent_map[mapping[0]] = mapping[1] agent_hostname = mesos_agent_map[agent_hostname] else: agent_hostname = "http://{}:5051".format(agent_hostname) logging.info( '\n\nSSH command:\n\nssh -t {ip} "cd /opt/mesos/slaves/*/frameworks/*/executors/{run}/runs/latest; exec \\$SHELL -l"\n\n'