'Disable a Parser
- Disconnect a Parser from a Channel
CLI API for shell scripts & to be called by S3Method'

@staticmethod
def parser_disable(id):

    db = current.db
    s3db = current.s3db
    table = s3db.msg_parser
    record = db((table.id == id)).select(table.id, table.enabled, table.channel_id, table.function_name, limitby=(0, 1)).first()
    if record.enabled:
        record.update_record(enabled=False)
    ttable = db.scheduler_task
    args = ('[%s,    "%s"]' % (record.channel_id, record.function_name))
    query = (((ttable.function_name == 'msg_parse') & (ttable.args == args)) & ttable.status.belongs(['RUNNING', 'QUEUED', 'ALLOCATED']))
    exists = db(query).select(ttable.id, limitby=(0, 1)).first()
    if exists:
        db(query).update(status='STOPPED')
        return 'Parser    disabled'
    else:
        return 'Parser    already    disabled'
