mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fixes for flake8-import-order 0.11
Also fix Python3 compatibility.
This commit is contained in:
@@ -6,11 +6,16 @@ datasets "(not ok)" and the successfully finished datasets "(ok)".
|
||||
Sample call:
|
||||
python filter_failed_datasets_from_collection.py <GalaxyUrl> <ApiKey> MySpecialHistory 1234
|
||||
"""
|
||||
import sys
|
||||
from bioblend.galaxy import GalaxyInstance
|
||||
from bioblend.galaxy import dataset_collections as collections
|
||||
from __future__ import print_function
|
||||
|
||||
if (len(sys.argv) < 5):
|
||||
import sys
|
||||
|
||||
from bioblend.galaxy import (
|
||||
dataset_collections as collections,
|
||||
GalaxyInstance
|
||||
)
|
||||
|
||||
if len(sys.argv) < 5:
|
||||
print("Usage: %s <GalaxyUrl> <ApiKey> <HistoryName (must be unique)> <CollectionHistoryId (i.e. the simple integer id)>" % sys.argv[0])
|
||||
exit(0)
|
||||
|
||||
@@ -28,20 +33,20 @@ if (len(historyMatches) > 1):
|
||||
|
||||
historyId = historyMatches[0]['id']
|
||||
historyContents = gi.histories.show_history(historyId, contents=True, deleted=False, visible=True, details=False)
|
||||
matchingCollections = filter(lambda x: x['hid'] == collectionHistoryId, historyContents)
|
||||
matchingCollections = [x for x in historyContents if x['hid'] == collectionHistoryId]
|
||||
|
||||
if (len(matchingCollections) == 0):
|
||||
if len(matchingCollections) == 0:
|
||||
print("Error: no collections matching that id found.")
|
||||
exit(1)
|
||||
|
||||
if (len(matchingCollections) > 1):
|
||||
if len(matchingCollections) > 1:
|
||||
print("Error: more than one collection matching that id found (WTF?)")
|
||||
exit(1)
|
||||
|
||||
collectionId = matchingCollections[0]['id']
|
||||
failedCollection = gi.histories.show_dataset_collection(historyId, collectionId)
|
||||
okDatasets = filter(lambda d: d['object']['state'] == 'ok' and d['object']['file_size'] > 0, failedCollection['elements'])
|
||||
notOkDatasets = filter(lambda d: d['object']['state'] != 'ok' or d['object']['file_size'] == 0, failedCollection['elements'])
|
||||
okDatasets = [d for d in failedCollection['elements'] if d['object']['state'] == 'ok' and d['object']['file_size'] > 0]
|
||||
notOkDatasets = [d for d in failedCollection['elements'] if d['object']['state'] != 'ok' or d['object']['file_size'] == 0]
|
||||
okCollectionName = failedCollection['name'] + " (ok)"
|
||||
notOkCollectionName = failedCollection['name'] + " (not ok)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user