def handleRemoveJobsAll(sessionKey, namespace, owner): """ current hack for removing all asyn jobs - to be removed when EAI endpoint gets written to do this... """ jobs = listJobs(sessionKey=sessionKey, namespace=namespace, owner=owner) cancelled_jobs = [] for job in jobs: j = getJob(job['sid']) j.cancel() cancelled_jobs.append(job['sid']) #Call the appropriate display function... try: DISPLAY_CHARS['jobs'](cmd='remove', obj='jobs', eaiArgsList={'jobid':cancelled_jobs}) except KeyError, e: logger.debug('endpoint: jobs') logger.debug(str(e)) raise
def reset(self, **kwargs): ''' Resets the user space to a clean state; usually used for testingm ''' has_perms = True if 'admin'==au.getCurrentUser()['name'] else False jobs_cancelled = [] if has_perms and cherrypy.request.method=='POST': jobs = se.listJobs() for job in jobs: try: j = se.getJob(job['sid']) j.cancel() jobs_cancelled.append(job['sid']) except splunk.ResourceNotFound: continue return self.render_template('debug/reset.html', { 'has_perms': has_perms, 'method': cherrypy.request.method, 'jobs_cancelled': jobs_cancelled })
def handleRemoveJobsAll(sessionKey, namespace, owner): """ current hack for removing all asyn jobs - to be removed when EAI endpoint gets written to do this... """ jobs = listJobs(sessionKey=sessionKey, namespace=namespace, owner=owner) cancelled_jobs = [] for job in jobs: j = getJob(job['sid']) j.cancel() cancelled_jobs.append(job['sid']) #Call the appropriate display function... try: DISPLAY_CHARS['jobs'](cmd='remove', obj='jobs', eaiArgsList={ 'jobid': cancelled_jobs }) except KeyError, e: logger.debug('endpoint: jobs') logger.debug(str(e)) raise