Esempio n. 1
0
def status(foreign_id=None):
    """Get the queue status (pending and finished tasks.)"""
    if foreign_id is not None:
        collection = get_collection(foreign_id)
        status = get_status(collection)
        status = {"datasets": {foreign_id: status}}
    else:
        status = get_active_collection_status()
    headers = ["Collection", "Job", "Stage", "Pending", "Running", "Finished"]
    rows = []
    for foreign_id, dataset in status.get("datasets").items():
        rows.append([
            foreign_id,
            "",
            "",
            dataset["pending"],
            dataset["running"],
            dataset["finished"],
        ])
        for job in dataset.get("jobs"):
            for stage in job.get("stages"):
                rows.append([
                    foreign_id,
                    stage["job_id"],
                    stage["stage"],
                    stage["pending"],
                    stage["running"],
                    stage["finished"],
                ])
    print(tabulate(rows, headers))
Esempio n. 2
0
def status():
    """
    ---
    get:
      summary: Get an overview of collections being processed
      description: >
        List collections being processed currently and pending task counts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemStatusResponse'
      tags:
      - System
    """
    require(request.authz.logged_in)
    status = get_active_collection_status()
    active_collections = status.pop('datasets', [])
    active_foreign_ids = set(active_collections.keys())
    collections = request.authz.collections(request.authz.READ)
    serializer = CollectionSerializer(reference=True)
    results = []
    for fid in sorted(active_foreign_ids):
        collection = Collection.by_foreign_id(fid)
        if collection is None:
            continue
        if collection.id in collections:
            result = active_collections[fid]
            result['collection'] = serializer.serialize(collection.to_dict())
            result['id'] = fid
            results.append(result)
    return jsonify({'results': results, 'total': len(results)})
Esempio n. 3
0
def status(foreign_id=None):
    """Get the queue status (pending and finished tasks.)"""
    if foreign_id is not None:
        collection = get_collection(foreign_id)
        status = get_status(collection)
    else:
        status = get_active_collection_status()
    pprint(status)
Esempio n. 4
0
def status():
    require(request.authz.logged_in)
    status = get_active_collection_status()
    active_collections = status.pop('datasets')
    active_foreign_ids = set(active_collections.keys())
    collections = request.authz.collections(request.authz.READ)
    results = []
    for fid in active_foreign_ids:
        collection = Collection.by_foreign_id(fid)
        if collection is None:
            continue
        if collection.id in collections:
            result = active_collections[fid]
            result['collection'] = collection.to_dict()
            result['id'] = fid
            results.append(result)
    status['results'] = results
    return jsonify(status)
Esempio n. 5
0
def status():
    require(request.authz.logged_in)
    status = get_active_collection_status()
    active_collections = status.pop('datasets', [])
    active_foreign_ids = set(active_collections.keys())
    collections = request.authz.collections(request.authz.READ)
    serializer = CollectionSerializer(reference=True)
    results = []
    for fid in sorted(active_foreign_ids):
        collection = Collection.by_foreign_id(fid)
        if collection is None:
            continue
        if collection.id in collections:
            result = active_collections[fid]
            result['collection'] = serializer.serialize(collection.to_dict())
            result['id'] = fid
            results.append(result)
    return jsonify({'results': results, 'total': len(results)})