def setup_management_exists(_type, _id, deployment_id):
 db = current.db
 ttable = current.s3db.scheduler_task
 args = ('["%s", "%s", "%s"]' % (_type, _id, deployment_id))
 query = (((ttable.function_name == 'setup_management') & (ttable.args == args)) & ttable.status.belongs(['RUNNING', 'QUEUED', 'ASSIGNED']))
 exists = db(query).select(ttable.id, limitby=(0, 1)).first()
 if exists:
  return True
 return False

def setup_management_exists ( _type , _id , deployment_id ) : db = current . db ttable = current . s3db . scheduler_task args = ( '["%s", "%s", "%s"]' % ( _type , _id , deployment_id ) ) query = ( ( ( ttable . function_name == 'setup_management' ) & ( ttable . args == args ) ) & ttable . status . belongs ( [ 'RUNNING' , 'QUEUED' , 'ASSIGNED' ] ) ) exists = db ( query ) . select ( ttable . id , limitby = ( 0 , 1 ) ) . first ( ) if exists : return True return False
returns true/false depending on whether a management task exists for an instance .