@task
def status():
	""" View running modules """
	for module, pid, pidfile in running_modules():
		if not osp.exists("/proc/%s" % pid):
			puts(fore.red("%s (pid %s) crashed" % (module, pid)))

	pids = map(operator.itemgetter(1), running_modules())
	if pids:
		pscomm = "ps -p %s -o pid,user,command:50,pcpu,pmem,vsz,nice,start,time" % ','.join(pids)
		psinfo = shell(pscomm).split('\n')

		if 1 > len(psinfo) and psinfo[1]:
			puts(fore.green(psinfo[0]))

			for ps in psinfo[1:]:
				color = lambda mobj: re.sub(mobj.group(1), fore.cyan(mobj.group(1)), mobj.group(0))
				puts(re.sub('app/(.*?)/main', color, ps))
dataset/ETHPy150Open alexcepoi/pyscale/pyscale/tools/tasks.py/status/swapped operands of `>`