'Look up all the running java jobs.
Returns:
dictionary keyed by package name (spinnaker subsystem) with pid values.'

def get_all_java_subsystem_jobs(self):

    re_pid_and_subsystem = None
    p = subprocess.Popen('jps    -l', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True)
    (stdout, stderr) = p.communicate()
    if (p.returncode == 0):
        re_pid_and_subsystem = re.compile('([0-9]+)    com\\.netflix\\.spinnaker\\.([^\\.]+)\\.')
    else:
        (stdout, stderr) = subprocess.Popen('ps    -fwwC    java', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True).communicate()
        re_pid_and_subsystem = re.compile('([0-9]+)    .*    -classpath    {install_root}/([^/]+)/'.format(install_root=self.__installation.SUBSYSTEM_ROOT_DIR))
    job_map = {}
    for match in re_pid_and_subsystem.finditer(stdout):
        name = match.groups()[1]
        pid = int(match.groups()[0])
        job_map[name] = pid
    return job_map
