if os.path.isdir(os.path.join(opts.volttron_root, agent_source)): agent_source = os.path.join(opts.volttron_root, agent_source) else: log.error("Invalid agent source directory specified.") sys.exit(-10) opts.agent_source = agent_source if not os.path.isfile(os.path.join(agent_source, "setup.py")): log.error("Agent source must contain a setup.py file.") sys.exit(-10) if opts.volttron_home.endswith('/'): log.warn("VOLTTRON_HOME should not have / on the end trimming it.") opts.volttron_home = opts.volttron_home[:-1] if not is_instance_running(opts.volttron_home): log.error("The instance at {} is not running".format( opts.volttron_home)) sys.exit(-10) wheelhouse = opts.wheelhouse if not wheelhouse: wheelhouse = os.path.join(opts.volttron_home, "packaged") opts.wheelhouse = wheelhouse if opts.priority != -1: if opts.priority < 0 or opts.priority >= 100: log.error("Invalid priority specified must be between 1, 100") sys.exit(-10) opts.enable = True
correct_python = os.path.abspath( os.path.join(mypath, '../env/bin/python')) if not os.path.exists(correct_python): log.error("Invalid location for the script {}".format(correct_python)) sys.exit(-10) # Call this script in a subprocess with the correct python interpreter. cmds = [correct_python, __file__] cmds.extend(sys.argv[1:]) process = subprocess.Popen(cmds, env=os.environ) process.wait() sys.exit(process.returncode) from volttron.platform import get_home, is_instance_running __version__ = '0.1' if __name__ == '__main__': parser = argparse.ArgumentParser(version=__version__) parser.add_argument("-vh", "--volttron-home", default=get_home()) args = parser.parse_args() result = is_instance_running(args.volttron_home) if result: result = 1 else: result = 0 sys.stdout.write("{}\n".format(int(result)))
if not inenv: mypath = os.path.dirname(__file__) correct_python = sys.executable if not os.path.exists(correct_python): log.error("Invalid location for the script {}".format(correct_python)) sys.exit(-10) # Call this script in a subprocess with the correct python interpreter. cmds = [correct_python, __file__] cmds.extend(sys.argv[1:]) process = subprocess.Popen(cmds, env=os.environ) process.wait() sys.exit(process.returncode) from volttron.platform import get_home, is_instance_running __version__ = '0.2' if __name__ == '__main__': parser = argparse.ArgumentParser(version=__version__) parser.add_argument("-vh", "--volttron-home", default=get_home()) args = parser.parse_args() result = is_instance_running(args.volttron_home) if result: result = 1 else: result = 0 sys.stdout.write("{}\n".format(int(result)))
if os.path.isdir(os.path.join(opts.volttron_root, agent_source)): agent_source = os.path.join(opts.volttron_root, agent_source) else: log.error("Invalid agent source directory specified.") sys.exit(-10) opts.agent_source = agent_source if not os.path.isfile(os.path.join(agent_source, "setup.py")): log.error("Agent source must contain a setup.py file.") sys.exit(-10) if opts.volttron_home.endswith('/'): log.warn("VOLTTRON_HOME should not have / on the end trimming it.") opts.volttron_home = opts.volttron_home[:-1] if not is_instance_running(opts.volttron_home): log.error("The instance at {} is not running".format( opts.volttron_home)) sys.exit(-10) wheelhouse = opts.wheelhouse if not wheelhouse: wheelhouse = os.path.join(opts.volttron_home, "packaged") opts.wheelhouse = wheelhouse if opts.priority != -1: if opts.priority < 0 or opts.priority >= 100: log.error("Invalid priority specified must be between 1, 100") sys.exit(-10) opts.enable = True