Ejemplo n.º 1
0
def cmd_tskill(view, edit, args, wd, rkey):
    if len(args) > 0:
        l = []
        for tid in args:
            tid = tid.lstrip('#')
            tid = tid_alias.get('%s-%s' % (tid, wd), tid)
            l.append('kill %s: %s' %
                     (tid, ('yes' if gs.cancel_task(tid) else 'no')))

        push_output(view, rkey, '\n'.join(l))
        return

    try:
        now = datetime.datetime.now().replace(microsecond=0)
        with gs.sm_lck:
            tasks = sorted(gs.sm_tasks.iteritems())

        l = []
        for tid, t in tasks:
            if t['cancel']:
                pfx = '#%s' % tid
            else:
                pfx = '(uninterruptible)'

            l.append('%s %s %s: %s' %
                     (pfx, (now - t['start'].replace(microsecond=0)),
                      t['domain'], t['message']))

        s = '\n'.join(l)
    except Exception as ex:
        gs.error_traceback(DOMAIN)
        s = 'Error: %s' % ex
    push_output(view, rkey, s)
Ejemplo n.º 2
0
def cmd_tskill(view, edit, args, wd, rkey):
	if len(args) > 0:
		l = []
		for tid in args:
			tid = tid.lstrip('#')
			l.append('kill %s: %s' % (tid, ('yes' if gs.cancel_task(tid) else 'no')))

		push_output(view, rkey, '\n'.join(l))
		return

	try:
		now = datetime.datetime.now().replace(microsecond=0)
		with gs.sm_lck:
			tasks = sorted(gs.sm_tasks.iteritems())

		l = []
		for tid, t in tasks:
			if t['cancel']:
				pfx = '#%s' % tid
			else:
				pfx = '(uninterruptible)'

			l.append('%s %s %s: %s' % (pfx, (now - t['start'].replace(microsecond=0)), t['domain'], t['message']))

		s = '\n'.join(l)
	except Exception as ex:
		gs.error_traceback(DOMAIN)
		s = 'Error: %s' % ex
	push_output(view, rkey, s)
Ejemplo n.º 3
0
 def cb(i):
     gs.cancel_task(m.get(i, ""))
Ejemplo n.º 4
0
 def cb(i):
     gs.cancel_task(m.get(i, ''))
Ejemplo n.º 5
0
		def cb(i):
			gs.cancel_task(m.get(i, ''))