Esempio n. 1
0
def get_gminfo(options):
    """获取gearman服务信息
    """
    gm_client = GearmanAdminClient([options.connection])
    if options.status:
        status = gm_client.get_status()
        return pretty_table(['task', 'queued', 'running', 'workers'], status)
    elif options.workers:
        workers = gm_client.get_workers()
        return pretty_table(['ip', 'client_id', 'tasks', 'file_descriptor'],
                            workers)
    elif options.shutdown:
        shutdown_info = gm_client.send_shutdown()
        return shutdown_info
    elif options.gmversion:
        version = gm_client.get_version()
        return version
def getStatus():
    adminClient = GearmanAdminClient([GearmanConfig.gearmanConnection])
    return adminClient.get_status()