Skip to content

Commit 5d19f6b

Browse files
authored
Merge pull request #5 from xmatthias/add_tasks
Add task commands
2 parents c3610ff + 5d9b561 commit 5d19f6b

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

qsAPI.py

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,69 @@ def UserDictAttributes(self, pUserID='full', key='name', attr='id'):
746746

747747

748748
#=========================================================================================
749-
750749

750+
def TaskGet(self, pFilter=None):
751+
'''
752+
@Function: retrieve Task information
753+
@param pFilter: filter the entities
754+
@return : json response
755+
'''
756+
return self.driver.get('/qrs/task/full', param={'filter': pFilter}).json()
757+
758+
def TaskStart(self, taskid):
759+
'''
760+
@Function: Starts a task by id and waits until a slave starts to execute a task
761+
@param taskid: taskid of the task to start
762+
'''
763+
return self.driver.post('/qrs/task/{taskid}/start'.format(taskid=taskid))
764+
765+
def TaskStartSynchronous(self, taskid):
766+
'''
767+
@Function: Starts a task by id and waits until a slave starts to execute a task
768+
@param taskid: taskid of the task to start
769+
'''
770+
return self.driver.post('/qrs/task/{taskid}/start/synchronous'.format(taskid=taskid))
771+
772+
773+
def TaskStartByName(self, taskname):
774+
'''
775+
@Function: Starts a task by name
776+
@param taskname: Name of the task to start
777+
'''
778+
return self.driver.post('/qrs/task/start', param={'name': taskname})
779+
780+
def TaskStartMany(self, taskids):
781+
'''
782+
@Function: Starts multiple tasks
783+
@param taskids: list of id's of the task to start
784+
Sample list: ["6ca1c5f2-2742-44d5-8adf-d6cba3701a4e","965ca0cf-952f-4502-a65e-2a82e3de4803"]
785+
'''
786+
return self.driver.post('/qrs/task/start/many', data=taskids)
787+
788+
def TaskStartByNameSynchronous(self, taskname):
789+
'''
790+
@Function: Starts a task and waits until a slave starts to execute a task
791+
@param taskname: Name of the task to start
792+
'''
793+
return self.driver.post('/qrs/task/start/synchronous', param={'name': taskname})
794+
795+
def TaskStop(self, taskid):
796+
'''
797+
@Function: Stops a task
798+
@param taskid: id of the task to stop
799+
'''
800+
return self.driver.post('/qrs/task/{taskid}/stop'.format(taskid=taskid))
801+
802+
def TaskStopMany(self, taskids):
803+
'''
804+
@Function: Stops multiple tasks
805+
@param taskname: list of id's of the task to stop
806+
Sample list: ["6ca1c5f2-2742-44d5-8adf-d6cba3701a4e","965ca0cf-952f-4502-a65e-2a82e3de4803"]
807+
'''
808+
return self.driver.post('/qrs/task/stop/many', data=taskids)
809+
810+
#=========================================================================================
811+
751812

752813
def SystemRules(self, pFilter=None):
753814
'''

0 commit comments

Comments
 (0)