def Starter(Task_ID): Connection = Connectors.Load_Main_Database() Cursor = Connection.cursor() PSQL_Update_Query = 'UPDATE tasks SET status = %s WHERE task_id = %s' Cursor.execute(PSQL_Update_Query, ( "Running", int(Task_ID), )) Connection.commit()
def __init__(self, File_Path, Internally_Requested, **kwargs): self.Internally_Requested = Internally_Requested self.Chrome_Config = Connectors.Load_Chrome_Configuration() self.File_Path = File_Path self.Connection = Connectors.Load_Main_Database() self.Cursor = self.Connection.cursor() if not self.Internally_Requested and kwargs.get( 'Screenshot_ID') and kwargs.get('Screenshot_User'): self.Screenshot_ID = kwargs['Screenshot_ID'] self.Screenshot_User = kwargs['Screenshot_User'] elif self.Internally_Requested and kwargs.get('Screenshot_Link'): self.Screenshot_ID = False self.Screenshot_User = False self.Screenshot_Link = kwargs['Screenshot_Link']
description='Plugin Caller calls Scrummage plugins.') Parser.add_argument( '-t', '--task', help= 'This option is used to specify a task ID to run. ./plugin_caller.py -t 1' ) Arguments = Parser.parse_args() Task_ID = 0 if Arguments.task: try: Task_ID = int(Arguments.task) Connection = Connectors.Load_Main_Database() cursor = Connection.cursor() PSQL_Select_Query = 'SELECT * FROM tasks WHERE task_id = %s;' cursor.execute(PSQL_Select_Query, (Task_ID, )) result = cursor.fetchone() if result: print(result[2]) print(result[5]) Plugin_to_Call = Plugin_Caller(Plugin_Name=result[2], Limit=result[5], Task_ID=Task_ID, Query=result[1]) Plugin_to_Call.Call_Plugin() except: