mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #4799 from nsoranzo/python3
Python3: fix remaining print statements
This commit is contained in:
@@ -57,6 +57,7 @@ lib/galaxy/managers/taggable.py
|
||||
lib/galaxy/model/
|
||||
lib/galaxy/objectstore/pulsar.py
|
||||
lib/galaxy/objectstore/s3_multipart_upload.py
|
||||
lib/galaxy/objectstore/s3.py
|
||||
lib/galaxy/openid/__init__.py
|
||||
lib/galaxy/quota/
|
||||
lib/galaxy/sample_tracking/data_transfer.py
|
||||
@@ -81,6 +82,7 @@ lib/galaxy/visualization/tracks/
|
||||
lib/galaxy/web/base/
|
||||
lib/galaxy/web/buildapp.py
|
||||
lib/galaxy/web/formatting.py
|
||||
lib/galaxy/web/form_builder.py
|
||||
lib/galaxy/web/framework/base.py
|
||||
lib/galaxy/web/framework/decorators.py
|
||||
lib/galaxy/web/framework/helpers/grids.py
|
||||
@@ -126,6 +128,7 @@ lib/galaxy/webapps/__init__.py
|
||||
lib/galaxy/webapps/reports/config.py
|
||||
lib/galaxy/webapps/reports/controllers/__init__.py
|
||||
lib/galaxy/webapps/reports/controllers/query.py
|
||||
lib/galaxy/webapps/reports/controllers/tools.py
|
||||
lib/galaxy/webapps/reports/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/api/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/controllers/groups.py
|
||||
|
||||
@@ -70,6 +70,7 @@ scripts/communication/
|
||||
scripts/data_libraries/build_whoosh_index.py
|
||||
scripts/db_shell.py
|
||||
scripts/drmaa_external_runner.py
|
||||
scripts/metagenomics/
|
||||
scripts/secret_decoder_ring.py
|
||||
test/
|
||||
tool_list.py
|
||||
|
||||
@@ -80,9 +80,6 @@ def main():
|
||||
config_sample.write(outputfile)
|
||||
outputfile.close()
|
||||
else:
|
||||
# print "----------"
|
||||
# config_sample.write(sys.stdout)
|
||||
# print "----------"
|
||||
logging.info("use -o OUTPUT to write the merged configuration into a file.")
|
||||
|
||||
logging.info("read Galaxy galaxy.ini.sample for detailed information.")
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
|
||||
import bx.intervals.io
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def stop_err(msg):
|
||||
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
|
||||
import bx.intervals.io
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def stop_err(msg):
|
||||
|
||||
@@ -8,7 +8,7 @@ import bx.align.maf
|
||||
|
||||
from galaxy.tools.util import maf_utilities
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
|
||||
@@ -8,7 +8,7 @@ import bx.align.maf
|
||||
|
||||
from galaxy.tools.util import maf_utilities
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 5)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
HEADER_STARTS_WITH = ('@')
|
||||
|
||||
|
||||
|
||||
@@ -260,8 +260,6 @@ class LimitedOffsetDataProvider(FilteredDataProvider):
|
||||
parent_gen = super(LimitedOffsetDataProvider, self).__iter__()
|
||||
for datum in parent_gen:
|
||||
self.num_data_returned -= 1
|
||||
# print 'self.num_data_returned:', self.num_data_returned
|
||||
# print 'self.num_valid_data_read:', self.num_valid_data_read
|
||||
|
||||
if self.num_valid_data_read > self.offset:
|
||||
self.num_data_returned += 1
|
||||
|
||||
@@ -4242,7 +4242,6 @@ class MetadataFile(StorableObject):
|
||||
return path
|
||||
except AttributeError:
|
||||
# In case we're not working with the history_dataset
|
||||
# print "Caught AttributeError"
|
||||
path = os.path.join(Dataset.file_path, '_metadata_files', *directory_hash_id(self.id))
|
||||
# Create directory if it does not exist
|
||||
try:
|
||||
|
||||
@@ -122,7 +122,6 @@ class ViewQueryBaseClass(object):
|
||||
clazz, attribute = field.sqlalchemy_field
|
||||
sqlalchemy_field_value = getattr(clazz, attribute)
|
||||
if operator == "=":
|
||||
# print field.sqlalchemy_field == right, field.sqlalchemy_field, right
|
||||
self.query = self.query.filter(sqlalchemy_field_value == right)
|
||||
elif operator == "!=":
|
||||
self.query = self.query.filter(sqlalchemy_field_value != right)
|
||||
@@ -166,7 +165,6 @@ def library_extended_metadata_filter(view, left, operator, right):
|
||||
view.state['extended_metadata_joined'] = True
|
||||
alias = aliased(ExtendedMetadataIndex)
|
||||
field = "/%s" % ("/".join(left.split(".")[1:]))
|
||||
# print "FIELD", field
|
||||
view.query = view.query.filter(
|
||||
and_(
|
||||
ExtendedMetadata.id == alias.extended_metadata_id,
|
||||
@@ -313,7 +311,6 @@ def history_dataset_extended_metadata_filter(view, left, operator, right):
|
||||
view.state['extended_metadata_joined'] = True
|
||||
alias = aliased(ExtendedMetadataIndex)
|
||||
field = "/%s" % ("/".join(left.split(".")[1:]))
|
||||
# print "FIELD", field
|
||||
view.query = view.query.filter(
|
||||
and_(
|
||||
ExtendedMetadata.id == alias.extended_metadata_id,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Object Store plugin for the Amazon Simple Storage Service (S3)
|
||||
"""
|
||||
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
@@ -9,9 +8,17 @@ import shutil
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
|
||||
import boto
|
||||
from boto.exception import S3ResponseError
|
||||
from boto.s3.connection import S3Connection
|
||||
from boto.s3.key import Key
|
||||
except ImportError:
|
||||
boto = None
|
||||
|
||||
from galaxy.exceptions import ObjectInvalid, ObjectNotFound
|
||||
from galaxy.util import (
|
||||
directory_hash_id,
|
||||
@@ -25,16 +32,6 @@ from galaxy.util.sleeper import Sleeper
|
||||
from .s3_multipart_upload import multipart_upload
|
||||
from ..objectstore import convert_bytes, ObjectStore
|
||||
|
||||
try:
|
||||
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
|
||||
import boto
|
||||
|
||||
from boto.exception import S3ResponseError
|
||||
from boto.s3.key import Key
|
||||
from boto.s3.connection import S3Connection
|
||||
except ImportError:
|
||||
boto = None
|
||||
|
||||
NO_BOTO_ERROR_MESSAGE = ("S3/Swift object store configured, but no boto dependency available."
|
||||
"Please install and properly configure boto or modify object store configuration.")
|
||||
|
||||
@@ -296,21 +293,21 @@ class S3ObjectStore(ObjectStore):
|
||||
# creates, this check sould be implemented- in the mean time, it's not
|
||||
# looking likely to be implementable reliably.
|
||||
# if os.path.exists(cache_path):
|
||||
# # print "***1 %s exists" % cache_path
|
||||
# # print("***1 %s exists" % cache_path)
|
||||
# if self._key_exists(rel_path):
|
||||
# # print "***2 %s exists in S3" % rel_path
|
||||
# # print("***2 %s exists in S3" % rel_path)
|
||||
# # Make sure the size in cache is available in its entirety
|
||||
# # print "File '%s' cache size: %s, S3 size: %s" % (cache_path, os.path.getsize(cache_path), self._get_size_in_s3(rel_path))
|
||||
# # print("File '%s' cache size: %s, S3 size: %s" % (cache_path, os.path.getsize(cache_path), self._get_size_in_s3(rel_path)))
|
||||
# if os.path.getsize(cache_path) == self._get_size_in_s3(rel_path):
|
||||
# # print "***2.1 %s exists in S3 and the size is the same as in cache (in_cache=True)" % rel_path
|
||||
# # print("***2.1 %s exists in S3 and the size is the same as in cache (in_cache=True)" % rel_path)
|
||||
# exists = True
|
||||
# else:
|
||||
# # print "***2.2 %s exists but differs in size from cache (in_cache=False)" % cache_path
|
||||
# # print("***2.2 %s exists but differs in size from cache (in_cache=False)" % cache_path)
|
||||
# exists = False
|
||||
# else:
|
||||
# # Although not perfect decision making, this most likely means
|
||||
# # that the file is currently being uploaded
|
||||
# # print "***3 %s found in cache but not in S3 (in_cache=True)" % cache_path
|
||||
# # print("***3 %s found in cache but not in S3 (in_cache=True)" % cache_path)
|
||||
# exists = True
|
||||
# else:
|
||||
# return False
|
||||
|
||||
@@ -35,7 +35,13 @@ ALL_CONTAINER_TYPES = [DOCKER_CONTAINER_TYPE, SINGULARITY_CONTAINER_TYPE]
|
||||
|
||||
LOAD_CACHED_IMAGE_COMMAND_TEMPLATE = '''
|
||||
python << EOF
|
||||
import re, tarfile, json, subprocess
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import tarfile
|
||||
|
||||
t = tarfile.TarFile("${cached_image_file}")
|
||||
meta_str = t.extractfile('repositories').read()
|
||||
meta = json.loads(meta_str)
|
||||
@@ -50,7 +56,7 @@ for line in stdo.split("\\n"):
|
||||
if tmp[0] == tag and tmp[1] == rev and tmp[2] == rev_value:
|
||||
found = True
|
||||
if not found:
|
||||
print "Loading image"
|
||||
print("Loading image")
|
||||
cmd = "cat ${cached_image_file} | ${load_cmd}"
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
EOF
|
||||
|
||||
@@ -271,14 +271,12 @@ class JobImportHistoryArchiveWrapper(object, UsesAnnotations):
|
||||
input_hda = self.sa_session.query(model.HistoryDatasetAssociation) \
|
||||
.filter_by(history=new_history, hid=value.hid).first()
|
||||
value = input_hda.id
|
||||
# print "added parameter %s-->%s to job %i" % ( name, value, imported_job.id )
|
||||
imported_job.add_parameter(name, dumps(value, cls=HistoryDatasetAssociationIDEncoder))
|
||||
|
||||
# TODO: Connect jobs to input datasets.
|
||||
|
||||
# Connect jobs to output datasets.
|
||||
for output_hid in job_attrs['output_datasets']:
|
||||
# print "%s job has output dataset %i" % (imported_job.id, output_hid)
|
||||
output_hda = self.sa_session.query(model.HistoryDatasetAssociation) \
|
||||
.filter_by(history=new_history, hid=output_hid).first()
|
||||
if output_hda:
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Classes encapsulating Galaxy tool parameters.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
from json import dumps
|
||||
|
||||
@@ -49,7 +51,7 @@ def visit_input_values(inputs, input_values, callback, name_prefix='', label_pre
|
||||
>>> f.cases = [Bunch(value='true', inputs= { 'h': h }), Bunch(value='false', inputs= { 'i': i })]
|
||||
>>>
|
||||
>>> def visitor(input, value, prefix, prefixed_name, **kwargs):
|
||||
... print 'name=%s, prefix=%s, prefixed_name=%s, value=%s' % (input.name, prefix, prefixed_name, value)
|
||||
... print('name=%s, prefix=%s, prefixed_name=%s, value=%s' % (input.name, prefix, prefixed_name, value))
|
||||
>>> inputs = odict([('a',a),('b',b)])
|
||||
>>> nested = odict([('a', 1), ('b', [odict([('c', 3), ('d', [odict([('e', 5), ('f', odict([('g', True), ('h', 7)]))])])])])])
|
||||
>>> visit_input_values(inputs, nested, visitor)
|
||||
@@ -249,13 +251,13 @@ def populate_state(request_context, inputs, incoming, state, errors={}, prefix='
|
||||
>>> flat = odict([('a', 1), ('b_0|c', 2), ('b_0|d_0|e', 3), ('b_0|d_0|f|h', 4), ('b_0|d_0|f|g', True)])
|
||||
>>> state = odict()
|
||||
>>> populate_state(trans, inputs, flat, state, check=False)
|
||||
>>> print state['a']
|
||||
>>> print(state['a'])
|
||||
1
|
||||
>>> print state['b'][0]['c']
|
||||
>>> print(state['b'][0]['c'])
|
||||
2
|
||||
>>> print state['b'][0]['d'][0]['e']
|
||||
>>> print(state['b'][0]['d'][0]['e'])
|
||||
3
|
||||
>>> print state['b'][0]['d'][0]['f']['h']
|
||||
>>> print(state['b'][0]['d'][0]['f']['h'])
|
||||
4
|
||||
"""
|
||||
context = ExpressionContext(state, context)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Tool Input Translation.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
|
||||
from galaxy.util.bunch import Bunch
|
||||
@@ -43,7 +45,7 @@ class ToolInputTranslator(object):
|
||||
... '''))
|
||||
>>> params = Params({'db':'hg17', 'URL':'URL_value', 'org':'Human', 'hgta_outputType':'primaryTable'})
|
||||
>>> translator.translate(params)
|
||||
>>> print sorted(list(params.__dict__.keys()))
|
||||
>>> print(sorted(params.__dict__.keys()))
|
||||
['URL', 'URL_method', 'data_type', 'db', 'dbkey', 'description', 'hgta_outputType', 'org', 'organism', 'table']
|
||||
>>> params.get('URL', None) in ['URL_value?GALAXY_URL=0&_export=1', 'URL_value?_export=1&GALAXY_URL=0']
|
||||
True
|
||||
|
||||
@@ -19,7 +19,7 @@ import bx.interval_index_file
|
||||
import bx.intervals
|
||||
from six.moves import xrange
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import os
|
||||
from __future__ import print_function
|
||||
|
||||
import copy
|
||||
import dictobj
|
||||
import os
|
||||
from collections import namedtuple
|
||||
|
||||
import dictobj
|
||||
|
||||
Path = namedtuple('Path', ('path', 'id', 'options'))
|
||||
|
||||
|
||||
@@ -46,23 +49,23 @@ class Node(dictobj.DictionaryObject):
|
||||
Example:
|
||||
>>> import jstree
|
||||
>>> node = jstree.Node('a', None)
|
||||
>>> print node
|
||||
>>> print(node)
|
||||
Node({'text': 'a', 'children': MutableDictionaryObject({})})
|
||||
>>> print node.jsonData()
|
||||
>>> print(node.jsonData())
|
||||
{'text': 'a'}
|
||||
|
||||
>>> import jstree
|
||||
>>> node = jstree.Node('a', 1)
|
||||
>>> print node
|
||||
>>> print(node)
|
||||
Node({'text': 'a', 'children': MutableDictionaryObject({}), 'li_attr': DictionaryObject({'id': 1}), 'id': 1})
|
||||
>>> print node.jsonData()
|
||||
>>> print(node.jsonData())
|
||||
{'text': 'a', 'id': 1, 'li_attr': {'id': 1}}
|
||||
|
||||
>>> import jstree
|
||||
>>> node = jstree.Node('a', 5, icon="folder", state = {'opened': True})
|
||||
>>> print node
|
||||
>>> print(node)
|
||||
Node({'text': 'a', 'id': 5, 'state': DictionaryObject({'opened': True}), 'children': MutableDictionaryObject({}), 'li_attr': DictionaryObject({'id': 5}), 'icon': 'folder'})
|
||||
>>> print node.jsonData()
|
||||
>>> print(node.jsonData())
|
||||
{'text': 'a', 'state': {'opened': True}, 'id': 5, 'li_attr': {'id': 5}, 'icon': 'folder'}
|
||||
"""
|
||||
super(Node, self).__init__()
|
||||
|
||||
@@ -104,7 +104,6 @@ class ColumnDataProvider(BaseDataProvider):
|
||||
(column >= 0)), (
|
||||
"column index (%d) must be positive and less" % (column) +
|
||||
" than the number of columns: %d" % (self.original_dataset.metadata.columns))
|
||||
# print columns, start_val, max_vals, skip_comments, kwargs
|
||||
|
||||
# set up the response, column lists
|
||||
response = {}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
"""
|
||||
Classes for generating HTML forms
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
|
||||
from six import string_types
|
||||
from cgi import escape
|
||||
from six import string_types
|
||||
|
||||
from galaxy.util import restore_text, unicodify
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -44,9 +47,9 @@ class TextField(BaseField):
|
||||
"""
|
||||
A standard text input box.
|
||||
|
||||
>>> print TextField( "foo" ).get_html()
|
||||
>>> print(TextField( "foo" ).get_html())
|
||||
<input type="text" name="foo" size="10" value="">
|
||||
>>> print TextField( "bins", size=4, value="default" ).get_html()
|
||||
>>> print(TextField( "bins", size=4, value="default" ).get_html())
|
||||
<input type="text" name="bins" size="4" value="default">
|
||||
"""
|
||||
|
||||
@@ -72,9 +75,9 @@ class PasswordField(BaseField):
|
||||
"""
|
||||
A password input box. text appears as "******"
|
||||
|
||||
>>> print PasswordField( "foo" ).get_html()
|
||||
>>> print(PasswordField( "foo" ).get_html())
|
||||
<input type="password" name="foo" size="10" value="">
|
||||
>>> print PasswordField( "bins", size=4, value="default" ).get_html()
|
||||
>>> print(PasswordField( "bins", size=4, value="default" ).get_html())
|
||||
<input type="password" name="bins" size="4" value="default">
|
||||
"""
|
||||
|
||||
@@ -101,9 +104,9 @@ class TextArea(BaseField):
|
||||
"""
|
||||
A standard text area box.
|
||||
|
||||
>>> print TextArea( "foo" ).get_html()
|
||||
>>> print(TextArea( "foo" ).get_html())
|
||||
<textarea name="foo" rows="5" cols="25"></textarea>
|
||||
>>> print TextArea( "bins", size="4x5", value="default" ).get_html()
|
||||
>>> print(TextArea( "bins", size="4x5", value="default" ).get_html())
|
||||
<textarea name="bins" rows="4" cols="5">default</textarea>
|
||||
"""
|
||||
_DEFAULT_SIZE = "5x25"
|
||||
@@ -136,9 +139,9 @@ class CheckboxField(BaseField):
|
||||
"""
|
||||
A checkbox (boolean input)
|
||||
|
||||
>>> print CheckboxField( "foo" ).get_html()
|
||||
>>> print(CheckboxField( "foo" ).get_html())
|
||||
<input type="checkbox" id="foo" name="foo" value="__CHECKED__"><input type="hidden" name="foo" value="__NOTHING__">
|
||||
>>> print CheckboxField( "bar", checked="yes" ).get_html()
|
||||
>>> print(CheckboxField( "bar", checked="yes" ).get_html())
|
||||
<input type="checkbox" id="bar" name="bar" value="__CHECKED__" checked="checked"><input type="hidden" name="bar" value="__NOTHING__">
|
||||
"""
|
||||
|
||||
@@ -186,9 +189,9 @@ class FileField(BaseField):
|
||||
"""
|
||||
A file upload input.
|
||||
|
||||
>>> print FileField( "foo" ).get_html()
|
||||
>>> print(FileField( "foo" ).get_html())
|
||||
<input type="file" name="foo">
|
||||
>>> print FileField( "foo", ajax = True ).get_html()
|
||||
>>> print(FileField( "foo", ajax = True ).get_html())
|
||||
<input type="file" name="foo" galaxy-ajax-upload="true">
|
||||
"""
|
||||
|
||||
@@ -233,7 +236,7 @@ class HiddenField(BaseField):
|
||||
"""
|
||||
A hidden field.
|
||||
|
||||
>>> print HiddenField( "foo", 100 ).get_html()
|
||||
>>> print(HiddenField( "foo", 100 ).get_html())
|
||||
<input type="hidden" name="foo" value="100">
|
||||
"""
|
||||
|
||||
@@ -259,7 +262,7 @@ class SelectField(BaseField):
|
||||
>>> t = SelectField( "foo", multiple=True )
|
||||
>>> t.add_option( "tuti", 1 )
|
||||
>>> t.add_option( "fruity", "x" )
|
||||
>>> print t.get_html()
|
||||
>>> print(t.get_html())
|
||||
<select name="foo" multiple>
|
||||
<option value="1">tuti</option>
|
||||
<option value="x">fruity</option>
|
||||
@@ -268,7 +271,7 @@ class SelectField(BaseField):
|
||||
>>> t = SelectField( "bar" )
|
||||
>>> t.add_option( "automatic", 3 )
|
||||
>>> t.add_option( "bazooty", 4, selected=True )
|
||||
>>> print t.get_html()
|
||||
>>> print(t.get_html())
|
||||
<select name="bar" last_selected_value="4">
|
||||
<option value="3">automatic</option>
|
||||
<option value="4" selected>bazooty</option>
|
||||
@@ -277,14 +280,14 @@ class SelectField(BaseField):
|
||||
>>> t = SelectField( "foo", display="radio" )
|
||||
>>> t.add_option( "tuti", 1 )
|
||||
>>> t.add_option( "fruity", "x" )
|
||||
>>> print t.get_html()
|
||||
>>> print(t.get_html())
|
||||
<div><input type="radio" name="foo" value="1" id="foo|1"><label class="inline" for="foo|1">tuti</label></div>
|
||||
<div><input type="radio" name="foo" value="x" id="foo|x"><label class="inline" for="foo|x">fruity</label></div>
|
||||
|
||||
>>> t = SelectField( "bar", multiple=True, display="checkboxes" )
|
||||
>>> t.add_option( "automatic", 3 )
|
||||
>>> t.add_option( "bazooty", 4, selected=True )
|
||||
>>> print t.get_html()
|
||||
>>> print(t.get_html())
|
||||
<div class="checkUncheckAllPlaceholder" checkbox_name="bar"></div>
|
||||
<div><input type="checkbox" name="bar" value="3" id="bar|3"><label class="inline" for="bar|3">automatic</label></div>
|
||||
<div><input type="checkbox" name="bar" value="4" id="bar|4" checked='checked'><label class="inline" for="bar|4">bazooty</label></div>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
|
||||
import collections
|
||||
import logging
|
||||
import galaxy.model
|
||||
import sqlalchemy as sa
|
||||
from datetime import timedelta
|
||||
|
||||
import sqlalchemy as sa
|
||||
from markupsafe import escape
|
||||
from sqlalchemy import and_
|
||||
|
||||
import galaxy.model
|
||||
from galaxy import util
|
||||
from galaxy.web.base.controller import BaseUIController, web
|
||||
|
||||
from sqlalchemy import and_
|
||||
from datetime import timedelta
|
||||
from markupsafe import escape
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -344,7 +344,6 @@ class Tools(BaseUIController):
|
||||
if word in to_replace:
|
||||
continue
|
||||
if words.count(word) > 1:
|
||||
print word
|
||||
to_replace.append(word)
|
||||
for word in to_replace:
|
||||
sentence = ("</br>" + word) * 2
|
||||
@@ -352,7 +351,6 @@ class Tools(BaseUIController):
|
||||
while sentence + "</br>" + word in new_key:
|
||||
sentence += "</br>" + word
|
||||
count += 1
|
||||
print sentence, count
|
||||
if sentence in new_key:
|
||||
new_key = new_key.replace(sentence, '</br>' + word + " [this line in %d times]" % (count))
|
||||
data[new_key] = counter[key]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to create initial tables.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -145,7 +147,7 @@ ToolAnnotationAssociation_table = Table("tool_annotation_association", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.create_all()
|
||||
Index('ix_tool_annotation_association_annotation', ToolAnnotationAssociation_table.c.annotation, mysql_length=767).create()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the suite column to the tool table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -19,7 +21,7 @@ metadata = MetaData()
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
metadata.bind = migrate_engine
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
Tool_table = Table("tool", metadata, autoload=True)
|
||||
@@ -34,9 +36,8 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_false = "false"
|
||||
migrate_engine.execute("UPDATE tool SET suite=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding suite column to the tool table failed: %s" % str(e)
|
||||
log.debug("Adding suite column to the tool table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding suite column to the tool table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -46,6 +47,5 @@ def downgrade(migrate_engine):
|
||||
Tool_table = Table("tool", metadata, autoload=True)
|
||||
try:
|
||||
Tool_table.c.suite.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column suite from the tool table failed: %s" % str(e)
|
||||
log.debug("Dropping column suite from the tool table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column suite from the tool table failed.")
|
||||
|
||||
+7
-5
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Adds the tool_rating_association table, enabling tools to be rated along with review comments.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -29,14 +31,14 @@ ToolRatingAssociation_table = Table("tool_rating_association", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
# Load existing tables
|
||||
metadata.reflect()
|
||||
try:
|
||||
ToolRatingAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_rating_association table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -45,5 +47,5 @@ def downgrade(migrate_engine):
|
||||
metadata.reflect()
|
||||
try:
|
||||
ToolRatingAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_rating_association table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Adds the repository, repository_rating_association and repository_category_association tables.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -47,22 +49,22 @@ RepositoryCategoryAssociation_table = Table("repository_category_association", m
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
# Load existing tables
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
try:
|
||||
Repository_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository table failed.")
|
||||
try:
|
||||
RepositoryRatingAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating repository_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository_rating_association table failed.")
|
||||
try:
|
||||
RepositoryCategoryAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating repository_category_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository_category_association table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -71,13 +73,13 @@ def downgrade(migrate_engine):
|
||||
metadata.reflect()
|
||||
try:
|
||||
Repository_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository table failed.")
|
||||
try:
|
||||
RepositoryRatingAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping repository_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository_rating_association table failed.")
|
||||
try:
|
||||
RepositoryCategoryAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping repository_category_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository_category_association table failed.")
|
||||
|
||||
+31
-29
@@ -3,6 +3,8 @@ Drops the tool, tool_category_association, event, tool_event_association, tool_r
|
||||
tool_tag_association and tool_annotation_association tables since they are no longer used in the
|
||||
next-gen tool shed.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -26,7 +28,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
# Load existing tables
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
@@ -37,8 +39,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool_category_association")
|
||||
try:
|
||||
ToolCategoryAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_category_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_category_association table failed.")
|
||||
# Load and then drop the tool_event_association table
|
||||
try:
|
||||
ToolEventAssociation_table = Table("tool_event_association", metadata, autoload=True)
|
||||
@@ -46,8 +48,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool_event_association")
|
||||
try:
|
||||
ToolEventAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_event_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_event_association table failed.")
|
||||
# Load and then drop the tool_rating_association table
|
||||
try:
|
||||
ToolRatingAssociation_table = Table("tool_rating_association", metadata, autoload=True)
|
||||
@@ -55,8 +57,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool_rating_association")
|
||||
try:
|
||||
ToolRatingAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_rating_association table failed.")
|
||||
# Load and then drop the tool_tag_association table
|
||||
try:
|
||||
ToolTagAssociation_table = Table("tool_tag_association", metadata, autoload=True)
|
||||
@@ -64,8 +66,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool_tag_association")
|
||||
try:
|
||||
ToolTagAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_tag_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_tag_association table failed.")
|
||||
# Load and then drop the tool_annotation_association table
|
||||
try:
|
||||
ToolAnnotationAssociation_table = Table("tool_annotation_association", metadata, autoload=True)
|
||||
@@ -73,8 +75,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool_annotation_association")
|
||||
try:
|
||||
ToolAnnotationAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool_annotation_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool_annotation_association table failed.")
|
||||
# Load and then drop the event table
|
||||
try:
|
||||
Event_table = Table("event", metadata, autoload=True)
|
||||
@@ -82,8 +84,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table event")
|
||||
try:
|
||||
Event_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping event table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping event table failed.")
|
||||
# Load and then drop the tool table
|
||||
try:
|
||||
Tool_table = Table("tool", metadata, autoload=True)
|
||||
@@ -91,8 +93,8 @@ def upgrade(migrate_engine):
|
||||
log.debug("Failed loading table tool")
|
||||
try:
|
||||
Tool_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping tool table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping tool table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -161,35 +163,35 @@ def downgrade(migrate_engine):
|
||||
# Create the event table
|
||||
try:
|
||||
Event_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating event table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating event table failed.")
|
||||
# Create the tool table
|
||||
try:
|
||||
Tool_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool table failed.")
|
||||
# Create the tool_category_association table
|
||||
try:
|
||||
ToolCategoryAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_category_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_category_association table failed.")
|
||||
# Create the tool_event_association table
|
||||
try:
|
||||
ToolEventAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_event_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_event_association table failed.")
|
||||
# Create the tool_rating_association table
|
||||
try:
|
||||
ToolRatingAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_rating_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_rating_association table failed.")
|
||||
# Create the tool_tag_association table
|
||||
try:
|
||||
ToolTagAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_tag_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_tag_association table failed.")
|
||||
# Create the tool_annotation_association table
|
||||
try:
|
||||
ToolAnnotationAssociation_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating tool_annotation_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating tool_annotation_association table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the email_alerts column to the repository table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -21,7 +23,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -31,9 +33,8 @@ def upgrade(migrate_engine):
|
||||
# Create
|
||||
c.create(Repository_table)
|
||||
assert c is Repository_table.c.email_alerts
|
||||
except Exception as e:
|
||||
print "Adding email_alerts column to the repository table failed: %s" % str(e)
|
||||
log.debug("Adding email_alerts column to the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding email_alerts column to the repository table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -43,6 +44,5 @@ def downgrade(migrate_engine):
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
try:
|
||||
Repository_table.c.email_alerts.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column email_alerts from the repository table failed: %s" % str(e)
|
||||
log.debug("Dropping column email_alerts from the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column email_alerts from the repository table failed.")
|
||||
|
||||
+11
-13
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the long_description and times_downloaded columns to the repository table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -18,7 +20,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -28,18 +30,16 @@ def upgrade(migrate_engine):
|
||||
# Create
|
||||
c.create(Repository_table)
|
||||
assert c is Repository_table.c.long_description
|
||||
except Exception as e:
|
||||
print "Adding long_description column to the repository table failed: %s" % str(e)
|
||||
log.debug("Adding long_description column to the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding long_description column to the repository table failed.")
|
||||
|
||||
c = Column("times_downloaded", Integer)
|
||||
try:
|
||||
# Create
|
||||
c.create(Repository_table)
|
||||
assert c is Repository_table.c.times_downloaded
|
||||
except Exception as e:
|
||||
print "Adding times_downloaded column to the repository table failed: %s" % str(e)
|
||||
log.debug("Adding times_downloaded column to the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding times_downloaded column to the repository table failed.")
|
||||
|
||||
cmd = "UPDATE repository SET long_description = ''"
|
||||
migrate_engine.execute(cmd)
|
||||
@@ -54,11 +54,9 @@ def downgrade(migrate_engine):
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
try:
|
||||
Repository_table.c.long_description.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column long_description from the repository table failed: %s" % str(e)
|
||||
log.debug("Dropping column long_description from the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column long_description from the repository table failed.")
|
||||
try:
|
||||
Repository_table.c.times_downloaded.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column times_downloaded from the repository table failed: %s" % str(e)
|
||||
log.debug("Dropping column times_downloaded from the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column times_downloaded from the repository table failed.")
|
||||
|
||||
+7
-7
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -31,15 +33,14 @@ RepositoryMetadata_table = Table("repository_metadata", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create repository_metadata table.
|
||||
try:
|
||||
RepositoryMetadata_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Creating repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -48,6 +49,5 @@ def downgrade(migrate_engine):
|
||||
# Drop repository_metadata table.
|
||||
try:
|
||||
RepositoryMetadata_table.drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Dropping repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository_metadata table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the malicious column to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -18,7 +20,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -34,9 +36,8 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_false = "false"
|
||||
migrate_engine.execute("UPDATE repository_metadata SET malicious=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding malicious column to the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Adding malicious column to the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding malicious column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -46,6 +47,5 @@ def downgrade(migrate_engine):
|
||||
Repository_metadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
try:
|
||||
Repository_metadata_table.c.malicious.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column malicious from the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Dropping column malicious from the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column malicious from the repository_metadata table failed.")
|
||||
|
||||
+7
-7
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the new_repo_alert column to the galaxy_user table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -18,7 +20,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -36,9 +38,8 @@ def upgrade(migrate_engine):
|
||||
else:
|
||||
log.debug("unknown migrate_engine dialect")
|
||||
migrate_engine.execute("UPDATE galaxy_user SET new_repo_alert=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding new_repo_alert column to the galaxy_user table failed: %s" % str(e)
|
||||
log.debug("Adding new_repo_alert column to the galaxy_user table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding new_repo_alert column to the galaxy_user table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -48,6 +49,5 @@ def downgrade(migrate_engine):
|
||||
User_table = Table("galaxy_user", metadata, autoload=True)
|
||||
try:
|
||||
User_table.c.new_repo_alert.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column new_repo_alert from the galaxy_user table failed: %s" % str(e)
|
||||
log.debug("Dropping column new_repo_alert from the galaxy_user table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column new_repo_alert from the galaxy_user table failed.")
|
||||
|
||||
+7
-5
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the tool_versions column to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -23,7 +25,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
@@ -32,8 +34,8 @@ def upgrade(migrate_engine):
|
||||
# Create
|
||||
c.create(RepositoryMetadata_table)
|
||||
assert c is RepositoryMetadata_table.c.tool_versions
|
||||
except Exception as e:
|
||||
print "Adding tool_versions column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding tool_versions column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -43,5 +45,5 @@ def downgrade(migrate_engine):
|
||||
RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
try:
|
||||
RepositoryMetadata_table.c.tool_versions.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column tool_versions from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column tool_versions from the repository_metadata table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the downloadable column to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -18,7 +20,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -34,8 +36,8 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_true = "true"
|
||||
migrate_engine.execute("UPDATE repository_metadata SET downloadable=%s" % default_true)
|
||||
except Exception as e:
|
||||
print "Adding downloadable column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding downloadable column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -45,5 +47,5 @@ def downgrade(migrate_engine):
|
||||
RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
try:
|
||||
RepositoryMetadata_table.c.downloadable.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column downloadable from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column downloadable from the repository_metadata table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the repository_review, component_review and component tables and the Repository Reviewer group and role.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -83,25 +85,22 @@ Component_table = Table("component", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create new review tables.
|
||||
try:
|
||||
Component_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Creating component table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating component table failed.")
|
||||
try:
|
||||
RepositoryReview_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Creating repository_review table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository_review table failed.")
|
||||
try:
|
||||
ComponentReview_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Creating component_review table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating component_review table failed.")
|
||||
# Insert default Component values.
|
||||
names = ['Data types', 'Functional tests', 'README', 'Tool dependencies', 'Tools', 'Workflows']
|
||||
descriptions = ['Proprietary datatypes defined in a file named datatypes_conf.xml included in the repository',
|
||||
@@ -170,19 +169,16 @@ def downgrade(migrate_engine):
|
||||
# Drop review tables.
|
||||
try:
|
||||
ComponentReview_table.drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Dropping component_review table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping component_review table failed.")
|
||||
try:
|
||||
RepositoryReview_table.drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Dropping repository_review table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository_review table failed.")
|
||||
try:
|
||||
Component_table.drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Dropping component table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping component table failed.")
|
||||
# Get the id of the REVIEWER group.
|
||||
cmd = "SELECT id FROM galaxy_group WHERE name = '%s';" % (IUC)
|
||||
row = migrate_engine.execute(cmd).fetchone()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the deprecated column to the repository table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -18,7 +20,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize imported column in job table.
|
||||
@@ -34,9 +36,8 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_false = "false"
|
||||
migrate_engine.execute("UPDATE repository SET deprecated=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding deprecated column to the repository table failed: %s" % str(e)
|
||||
log.debug("Adding deprecated column to the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding deprecated column to the repository table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -46,6 +47,5 @@ def downgrade(migrate_engine):
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
try:
|
||||
Repository_table.c.deprecated.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column deprecated from the repository table failed: %s" % str(e)
|
||||
log.debug("Dropping column deprecated from the repository table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column deprecated from the repository table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the api_keys table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -30,13 +32,13 @@ APIKeys_table = Table("api_keys", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
try:
|
||||
APIKeys_table.create()
|
||||
except Exception as e:
|
||||
log.debug("Creating api_keys table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating api_keys table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -45,5 +47,5 @@ def downgrade(migrate_engine):
|
||||
metadata.reflect()
|
||||
try:
|
||||
APIKeys_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping api_keys table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping api_keys table failed.")
|
||||
|
||||
+19
-25
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the tool_test_errors, do_not_test, tools_functionally_correct, and time_last_tested columns to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -21,7 +23,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create and initialize tools_functionally_correct, do_not_test, time_last_tested, and tool_test_errors columns in repository_metadata table.
|
||||
@@ -37,9 +39,8 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_false = "false"
|
||||
migrate_engine.execute("UPDATE repository_metadata SET tools_functionally_correct=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding tools_functionally_correct column to the repository_metadata table failed.")
|
||||
c = Column("do_not_test", Boolean, default=False, index=True)
|
||||
try:
|
||||
# Create do_not_test column
|
||||
@@ -51,25 +52,22 @@ def upgrade(migrate_engine):
|
||||
elif migrate_engine.name in ['postgresql', 'postgres']:
|
||||
default_false = "false"
|
||||
migrate_engine.execute("UPDATE repository_metadata SET do_not_test=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding do_not_test column to the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Adding do_not_test column to the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding do_not_test column to the repository_metadata table failed.")
|
||||
c = Column("time_last_tested", DateTime, default=None, nullable=True)
|
||||
try:
|
||||
# Create time_last_tested column
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_tlt")
|
||||
assert c is RepositoryMetadata_table.c.time_last_tested
|
||||
except Exception as e:
|
||||
print "Adding time_last_tested column to the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Adding time_last_tested column to the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding time_last_tested column to the repository_metadata table failed.")
|
||||
c = Column("tool_test_errors", JSONType, nullable=True)
|
||||
try:
|
||||
# Create tool_test_errors column
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_tte")
|
||||
assert c is RepositoryMetadata_table.c.tool_test_errors
|
||||
except Exception as e:
|
||||
print "Adding tool_test_errors column to the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Adding tool_test_errors column to the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Adding tool_test_errors column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -79,21 +77,17 @@ def downgrade(migrate_engine):
|
||||
RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
try:
|
||||
RepositoryMetadata_table.c.tool_test_errors.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column tool_test_errors from the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Dropping column tool_test_errors from the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column tool_test_errors from the repository_metadata table failed.")
|
||||
try:
|
||||
RepositoryMetadata_table.c.time_last_tested.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column time_last_tested from the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Dropping column time_last_tested from the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column time_last_tested from the repository_metadata table failed.")
|
||||
try:
|
||||
RepositoryMetadata_table.c.do_not_test.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column do_not_test from the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Dropping column do_not_test from the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column do_not_test from the repository_metadata table failed.")
|
||||
try:
|
||||
RepositoryMetadata_table.c.tools_functionally_correct.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str(e)
|
||||
log.debug("Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping column tools_functionally_correct from the repository_metadata table failed.")
|
||||
|
||||
+23
-21
@@ -2,6 +2,8 @@
|
||||
Migration script to add the includes_datatypes, has_repository_dependencies, includes_tools, includes_tool_dependencies and includes_workflows
|
||||
columns to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -19,7 +21,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Initialize.
|
||||
@@ -36,8 +38,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_inc_datatypes")
|
||||
assert c is RepositoryMetadata_table.c.includes_datatypes
|
||||
migrate_engine.execute("UPDATE repository_metadata SET includes_datatypes=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding includes_datatypes column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding includes_datatypes column to the repository_metadata table failed.")
|
||||
|
||||
# Create includes_datatypes column
|
||||
c = Column("has_repository_dependencies", Boolean, default=False, index=True)
|
||||
@@ -45,8 +47,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_has_repo_deps")
|
||||
assert c is RepositoryMetadata_table.c.has_repository_dependencies
|
||||
migrate_engine.execute("UPDATE repository_metadata SET has_repository_dependencies=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding has_repository_dependencies column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding has_repository_dependencies column to the repository_metadata table failed.")
|
||||
|
||||
# Create includes_tools column
|
||||
c = Column("includes_tools", Boolean, default=False, index=True)
|
||||
@@ -54,8 +56,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_inc_tools")
|
||||
assert c is RepositoryMetadata_table.c.includes_tools
|
||||
migrate_engine.execute("UPDATE repository_metadata SET includes_tools=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding includes_tools column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding includes_tools column to the repository_metadata table failed.")
|
||||
|
||||
# Create includes_tool_dependencies column
|
||||
c = Column("includes_tool_dependencies", Boolean, default=False, index=True)
|
||||
@@ -63,8 +65,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_inc_tool_deps")
|
||||
assert c is RepositoryMetadata_table.c.includes_tool_dependencies
|
||||
migrate_engine.execute("UPDATE repository_metadata SET includes_tool_dependencies=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding includes_tool_dependencies column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding includes_tool_dependencies column to the repository_metadata table failed.")
|
||||
|
||||
# Create includes_workflows column
|
||||
c = Column("includes_workflows", Boolean, default=False, index=True)
|
||||
@@ -72,8 +74,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_inc_workflows")
|
||||
assert c is RepositoryMetadata_table.c.includes_workflows
|
||||
migrate_engine.execute("UPDATE repository_metadata SET includes_workflows=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding includes_workflows column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding includes_workflows column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -85,29 +87,29 @@ def downgrade(migrate_engine):
|
||||
# Drop the includes_workflows column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.includes_workflows.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column includes_workflows from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column includes_workflows from the repository_metadata table failed.")
|
||||
|
||||
# Drop the includes_tool_dependencies column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.includes_tool_dependencies.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column includes_tool_dependencies from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column includes_tool_dependencies from the repository_metadata table failed.")
|
||||
|
||||
# Drop the includes_tools column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.includes_tools.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column includes_tools from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column includes_tools from the repository_metadata table failed.")
|
||||
|
||||
# Drop the has_repository_dependencies column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.has_repository_dependencies.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column has_repository_dependencies from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column has_repository_dependencies from the repository_metadata table failed.")
|
||||
|
||||
# Drop the includes_datatypes column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.includes_datatypes.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column includes_datatypes from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column includes_datatypes from the repository_metadata table failed.")
|
||||
|
||||
+15
-13
@@ -2,6 +2,8 @@
|
||||
Migration script to alter the repository_metadata table by dropping the tool_test_errors column and adding columns
|
||||
tool_test_results, missing_test_components.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -23,7 +25,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Initialize.
|
||||
@@ -44,16 +46,16 @@ def upgrade(migrate_engine):
|
||||
try:
|
||||
col = RepositoryMetadata_table.c.tool_test_errors
|
||||
col.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping column 'tool_test_errors' from repository_metadata table failed: %s" % (str(e)))
|
||||
except Exception:
|
||||
log.exception("Dropping column 'tool_test_errors' from repository_metadata table failed.")
|
||||
|
||||
# Create the tool_test_results column to replace the ill-named tool_test_errors column just dropped above.
|
||||
c = Column("tool_test_results", JSONType, nullable=True)
|
||||
try:
|
||||
c.create(RepositoryMetadata_table)
|
||||
assert c is RepositoryMetadata_table.c.tool_test_results
|
||||
except Exception as e:
|
||||
print "Adding tool_test_results column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding tool_test_results column to the repository_metadata table failed.")
|
||||
|
||||
# Create the missing_test_components column.
|
||||
c = Column("missing_test_components", Boolean, default=False, index=True)
|
||||
@@ -61,8 +63,8 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_mtc")
|
||||
assert c is RepositoryMetadata_table.c.missing_test_components
|
||||
migrate_engine.execute("UPDATE repository_metadata SET missing_test_components=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding missing_test_components column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding missing_test_components column to the repository_metadata table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -74,19 +76,19 @@ def downgrade(migrate_engine):
|
||||
# Drop the missing_test_components column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.missing_test_components.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column missing_test_components from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column missing_test_components from the repository_metadata table failed.")
|
||||
|
||||
# Drop the tool_test_results column.
|
||||
try:
|
||||
RepositoryMetadata_table.c.tool_test_results.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column tool_test_results from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column tool_test_results from the repository_metadata table failed.")
|
||||
|
||||
# Create the tool_test_errors column.
|
||||
c = Column("tool_test_errors", JSONType, nullable=True)
|
||||
try:
|
||||
c.create(RepositoryMetadata_table)
|
||||
assert c is RepositoryMetadata_table.c.tool_test_errors
|
||||
except Exception as e:
|
||||
print "Adding tool_test_errors column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding tool_test_errors column to the repository_metadata table failed.")
|
||||
|
||||
+11
-9
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add the skip_tool_test table and add the test_install_error column to the repository_metadata table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -33,7 +35,7 @@ SkipToolTest_table = Table("skip_tool_test", metadata,
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Initialize.
|
||||
@@ -55,14 +57,14 @@ def upgrade(migrate_engine):
|
||||
c.create(RepositoryMetadata_table, index_name="ix_repository_metadata_ttie")
|
||||
assert c is RepositoryMetadata_table.c.test_install_error
|
||||
migrate_engine.execute("UPDATE repository_metadata SET test_install_error=%s" % default_false)
|
||||
except Exception as e:
|
||||
print "Adding test_install_error column to the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding test_install_error column to the repository_metadata table failed.")
|
||||
|
||||
# Create skip_tool_test table.
|
||||
try:
|
||||
SkipToolTest_table.create()
|
||||
except Exception as e:
|
||||
print "Creating the skip_tool_test table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Creating the skip_tool_test table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -72,12 +74,12 @@ def downgrade(migrate_engine):
|
||||
# Drop the skip_tool_test table.
|
||||
try:
|
||||
SkipToolTest_table.drop()
|
||||
except Exception as e:
|
||||
print "Dropping the skip_tool_test table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping the skip_tool_test table failed.")
|
||||
|
||||
# Drop test_install_error column from the repository_metadata table.
|
||||
RepositoryMetadata_table = Table("repository_metadata", metadata, autoload=True)
|
||||
try:
|
||||
RepositoryMetadata_table.c.test_install_error.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column test_install_error from the repository_metadata table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column test_install_error from the repository_metadata table failed.")
|
||||
|
||||
+7
-5
@@ -1,4 +1,6 @@
|
||||
"""Migration script to add the type column to the repository table."""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -19,7 +21,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
@@ -28,8 +30,8 @@ def upgrade(migrate_engine):
|
||||
# Create
|
||||
c.create(Repository_table, index_name="ix_repository_type")
|
||||
assert c is Repository_table.c.type
|
||||
except Exception as e:
|
||||
print "Adding type column to the repository table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding type column to the repository table failed.")
|
||||
# Update the type column to have the default unrestricted value.
|
||||
cmd = "UPDATE repository SET type = 'unrestricted'"
|
||||
migrate_engine.execute(cmd)
|
||||
@@ -42,5 +44,5 @@ def downgrade(migrate_engine):
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
try:
|
||||
Repository_table.c.type.drop()
|
||||
except Exception as e:
|
||||
print "Dropping column type from the repository table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column type from the repository table failed.")
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
"""Migration script to change repository.type column value from generic to unrestricted."""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -16,7 +18,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Update the type column to have the default unrestricted value.
|
||||
|
||||
+7
-6
@@ -3,6 +3,8 @@ Migration script to create the repository_role_association table, insert name-sp
|
||||
repository administrative roles into the role table and associate each repository and
|
||||
owner with the appropriate name-spaced role.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
@@ -59,15 +61,14 @@ def boolean_false(migrate_engine):
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
# Create the new repository_role_association table.
|
||||
try:
|
||||
RepositoryRoleAssociation_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
log.debug("Creating repository_role_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Creating repository_role_association table failed.")
|
||||
# Select the list of repositories and associated public user names for their owners.
|
||||
user_ids = []
|
||||
repository_ids = []
|
||||
@@ -159,5 +160,5 @@ def downgrade(migrate_engine):
|
||||
log.debug("Failed loading table repository_role_association")
|
||||
try:
|
||||
RepositoryRoleAssociation_table.drop()
|
||||
except Exception as e:
|
||||
log.debug("Dropping repository_role_association table failed: %s" % str(e))
|
||||
except Exception:
|
||||
log.exception("Dropping repository_role_association table failed.")
|
||||
|
||||
+7
-5
@@ -2,6 +2,8 @@
|
||||
Migration script to add the remote_repository_url and homepage_url
|
||||
columns to the repository table.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
@@ -21,7 +23,7 @@ metadata = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.bind = migrate_engine
|
||||
metadata.reflect()
|
||||
Repository_table = Table("repository", metadata, autoload=True)
|
||||
@@ -33,8 +35,8 @@ def upgrade(migrate_engine):
|
||||
c_homepage.create(Repository_table)
|
||||
assert c_remote is Repository_table.c.remote_repository_url
|
||||
assert c_homepage is Repository_table.c.homepage_url
|
||||
except Exception as e:
|
||||
print "Adding remote_repository_url and homepage_url columns to the repository table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Adding remote_repository_url and homepage_url columns to the repository table failed.")
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
@@ -45,5 +47,5 @@ def downgrade(migrate_engine):
|
||||
try:
|
||||
Repository_table.c.remote_repository_url.drop()
|
||||
Repository_table.c.homepage_url.drop()
|
||||
except Exception as e:
|
||||
print "Dropping columns remote_repository_url and homepage_url from the repository table failed: %s" % str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping columns remote_repository_url and homepage_url from the repository table failed.")
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script for the password reset table
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
@@ -18,12 +20,11 @@ PasswordResetToken_table = Table("password_reset_token", metadata,
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
metadata.bind = migrate_engine
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.reflect()
|
||||
try:
|
||||
PasswordResetToken_table.create()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
except Exception:
|
||||
log.exception("Creating %s table failed", PasswordResetToken_table.name)
|
||||
|
||||
|
||||
@@ -32,6 +33,5 @@ def downgrade(migrate_engine):
|
||||
metadata.reflect()
|
||||
try:
|
||||
PasswordResetToken_table.drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping %s table failed", PasswordResetToken_table.name)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Migration script to add session update time (used for timeouts)
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
@@ -13,7 +15,7 @@ metadata = MetaData()
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
metadata.bind = migrate_engine
|
||||
print __doc__
|
||||
print(__doc__)
|
||||
metadata.reflect()
|
||||
|
||||
lastaction_column = Column("last_action", DateTime)
|
||||
@@ -31,8 +33,7 @@ def __add_column(column, table_name, metadata, **kwds):
|
||||
try:
|
||||
table = Table(table_name, metadata, autoload=True)
|
||||
column.create(table, **kwds)
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
except Exception:
|
||||
log.exception("Adding column %s failed.", column)
|
||||
|
||||
|
||||
@@ -40,6 +41,5 @@ def __drop_column(column_name, table_name, metadata):
|
||||
try:
|
||||
table = Table(table_name, metadata, autoload=True)
|
||||
getattr(table.c, column_name).drop()
|
||||
except Exception as e:
|
||||
print str(e)
|
||||
except Exception:
|
||||
log.exception("Dropping column %s failed.", column_name)
|
||||
|
||||
@@ -1807,7 +1807,7 @@ class SetupVirtualEnv(Download, RecipeStep):
|
||||
# to subprocess.Popen.
|
||||
for site_packages_command in [r"""%s -c 'import site; site.getsitepackages()[0]'""" %
|
||||
os.path.join(venv_directory, "bin", "python"),
|
||||
r"""%s -c 'import os, sys; print os.path.join( sys.prefix, "lib", "python" + sys.version[:3], "site-packages" )'""" %
|
||||
r"""%s -c 'from __future__ import print_function; import os, sys; print(os.path.join(sys.prefix, "lib", "python" + sys.version[:3], "site-packages"))'""" %
|
||||
os.path.join(venv_directory, "bin", "python")]:
|
||||
output = install_environment.handle_command(tool_dependency=tool_dependency,
|
||||
cmd=site_packages_command,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
from common import submit
|
||||
@@ -22,7 +24,7 @@ def copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, mes
|
||||
if __name__ == '__main__':
|
||||
num_args = len(sys.argv)
|
||||
if num_args < 6:
|
||||
print >> sys.stderr, usage
|
||||
print(usage, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
(base_url, key, hda_id, library_id, folder_id) = sys.argv[1:6]
|
||||
@@ -31,5 +33,5 @@ if __name__ == '__main__':
|
||||
if num_args >= 7:
|
||||
message = sys.argv[6]
|
||||
|
||||
print >> sys.stderr, base_url, key, hda_id, library_id, folder_id, message
|
||||
print(base_url, key, hda_id, library_id, folder_id, message, file=sys.stderr)
|
||||
returned = copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, message)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
@@ -66,14 +68,11 @@ class Uploader:
|
||||
|
||||
fk = '/'.join(path_parts)
|
||||
if fk in self.memo_path:
|
||||
# print "Cache hit %s" % fk
|
||||
return self.memo_path[fk]
|
||||
else:
|
||||
# print "Cache miss %s" % fk
|
||||
for i in reversed(range(len(path_parts))):
|
||||
fk = '/'.join(path_parts[0:i + 1])
|
||||
if fk in self.memo_path:
|
||||
# print "Parent folder hit %s" % fk
|
||||
dropped_prefix = path_parts[0:i + 1]
|
||||
path_parts = path_parts[i + 1:]
|
||||
base_folder = self.memo_path[fk]
|
||||
@@ -84,7 +83,7 @@ class Uploader:
|
||||
nfk.append('/'.join(list(dropped_prefix) + list(path_parts[0:i + 1])))
|
||||
|
||||
# Recursively create the path from our base_folder starting points,
|
||||
# gettting the IDs of each folder per path component
|
||||
# getting the IDs of each folder per path component
|
||||
ids = self.recursively_build_path(path_parts, base_folder)
|
||||
|
||||
# These are then associated with the paths.
|
||||
@@ -102,7 +101,6 @@ class Uploader:
|
||||
else:
|
||||
pf = self.gi.libraries.create_folder(self.library_id, path_parts[0], base_folder_id=parent_folder_id)
|
||||
ids.append(pf[0]['id'])
|
||||
# print "create_folder(%s, %s, %s) = %s" % (self.library_id, path_parts[0], parent_folder_id, pf[0]['id'])
|
||||
return self.recursively_build_path(path_parts[1:], pf[0]['id'], ids=ids)
|
||||
|
||||
# http://stackoverflow.com/questions/13505819/python-split-path-recursively/13505966#13505966
|
||||
|
||||
@@ -24,7 +24,6 @@ def main():
|
||||
except IndexError:
|
||||
print('usage: %s key galaxy_url workflow_file' % os.path.basename(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
# print display( api_key, api_base_url + "/api/workflows" )
|
||||
submit(api_key, api_url, data, return_formatted=False)
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ log = logging.getLogger()
|
||||
log.setLevel(logging.INFO)
|
||||
log.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -27,7 +27,7 @@ log = logging.getLogger()
|
||||
log.setLevel(logging.INFO)
|
||||
log.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -14,7 +14,7 @@ import uuid
|
||||
from galaxy.model import mapping
|
||||
from galaxy.model.orm.scripts import get_config
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def usage(prog):
|
||||
|
||||
@@ -8,7 +8,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def usage(prog):
|
||||
|
||||
@@ -8,7 +8,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def usage(prog):
|
||||
|
||||
@@ -12,7 +12,7 @@ from six.moves import configparser
|
||||
|
||||
import galaxy.app
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def usage(prog):
|
||||
|
||||
@@ -17,7 +17,7 @@ sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pa
|
||||
import galaxy.app
|
||||
import galaxy.datatypes.tabular
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def usage(prog):
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ sa_session = init('/tmp/', db_url).context
|
||||
# http://stackoverflow.com/questions/5631078/sqlalchemy-print-the-actual-query
|
||||
def printquery(statement, bind=None):
|
||||
"""
|
||||
print a query, with values filled in
|
||||
Print a query, with values filled in
|
||||
for debugging purposes *only*
|
||||
for security, you should always separate queries from their values
|
||||
please also note that this function is quite slow
|
||||
|
||||
@@ -123,9 +123,8 @@ def getfnl(startdir):
|
||||
if fn.endswith('.xml'):
|
||||
try:
|
||||
doc = ET.parse(fullfn)
|
||||
except:
|
||||
print "Oops, bad xml in: ", fullfn
|
||||
raise
|
||||
except Exception as e:
|
||||
raise Exception("Oops, bad XML in '%s': %s" % (fullfn, e))
|
||||
rootelement = doc.getroot()
|
||||
# here we check if this xml file actually is a tool conf xml!
|
||||
if rootelement.tag == 'tool':
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
lib = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "lib"))
|
||||
sys.path.insert(1, lib)
|
||||
|
||||
import pkg_resources
|
||||
print pkg_resources.get_platform()
|
||||
print(pkg_resources.get_platform())
|
||||
|
||||
+6
-4
@@ -4,6 +4,8 @@ A command line helper for common operations performed by Galaxy maintainers.
|
||||
Encodes and decodes IDs, returns Dataset IDs if provided an HDA or LDDA id,
|
||||
returns the disk path of a dataset.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from ConfigParser import ConfigParser
|
||||
@@ -41,10 +43,10 @@ helper = security.SecurityHelper(id_secret=config.get('app:main', 'id_secret'))
|
||||
model = mapping.init(config.get('app:main', 'file_path'), config.get('app:main', 'database_connection'), create_tables=False)
|
||||
|
||||
if options.encode_id:
|
||||
print 'Encoded "%s": %s' % (options.encode_id, helper.encode_id(options.encode_id))
|
||||
print('Encoded "%s": %s' % (options.encode_id, helper.encode_id(options.encode_id)))
|
||||
|
||||
if options.decode_id:
|
||||
print 'Decoded "%s": %s' % (options.decode_id, helper.decode_id(options.decode_id))
|
||||
print('Decoded "%s": %s' % (options.decode_id, helper.decode_id(options.decode_id)))
|
||||
|
||||
if options.hda_id:
|
||||
try:
|
||||
@@ -52,7 +54,7 @@ if options.hda_id:
|
||||
except:
|
||||
hda_id = int(helper.decode_id(options.hda_id))
|
||||
hda = model.context.current.query(model.HistoryDatasetAssociation).get(hda_id)
|
||||
print 'HDA "%s" is Dataset "%s" at: %s' % (hda.id, hda.dataset.id, hda.file_name)
|
||||
print('HDA "%s" is Dataset "%s" at: %s' % (hda.id, hda.dataset.id, hda.file_name))
|
||||
|
||||
if options.ldda_id:
|
||||
try:
|
||||
@@ -60,4 +62,4 @@ if options.ldda_id:
|
||||
except:
|
||||
ldda_id = int(helper.decode_id(options.ldda_id))
|
||||
ldda = model.context.current.query(model.HistoryDatasetAssociation).get(ldda_id)
|
||||
print 'LDDA "%s" is Dataset "%s" at: %s' % (ldda.id, ldda.dataset.id, ldda.file_name)
|
||||
print('LDDA "%s" is Dataset "%s" at: %s' % (ldda.id, ldda.dataset.id, ldda.file_name))
|
||||
|
||||
@@ -23,6 +23,8 @@ usage: %prog [options]
|
||||
-a, --append=a: Append to existing all_fasta.loc file rather than create new
|
||||
-p, --sample-text=p: Copy over text from all_fasta.loc.sample file (false if set to append)
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
@@ -199,16 +201,16 @@ def __main__():
|
||||
paths_to_look_in = [os.path.join(options.genome_dir, '%s')]
|
||||
|
||||
# say what we're looking in
|
||||
print '\nLooking in:\n\t%s' % '\n\t'.join([p % '<build_name>' for p in paths_to_look_in])
|
||||
print('\nLooking in:\n\t%s' % '\n\t'.join(p % '<build_name>' for p in paths_to_look_in))
|
||||
poss_names = ['<build_name>%s' % _ for _ in variants]
|
||||
print 'for files that are named %s' % ', '.join(poss_names[:-1]),
|
||||
print('for files that are named %s' % ', '.join(poss_names[:-1]), end=' ')
|
||||
if len(poss_names) > 1:
|
||||
print 'or %s' % poss_names[-1],
|
||||
print('or %s' % poss_names[-1], end=' ')
|
||||
if len(options.fasta_exts) == 1:
|
||||
print 'with the extension %s.' % ', '.join(fasta_exts[:-1])
|
||||
print('with the extension %s.' % ', '.join(fasta_exts[:-1]))
|
||||
else:
|
||||
print 'with the extension %s or %s.' % (', '.join(fasta_exts[:-1]), fasta_exts[-1])
|
||||
print '\nSkipping the following:\n\t%s' % '\n\t'.join(exemptions)
|
||||
print('with the extension %s or %s.' % (', '.join(fasta_exts[:-1]), fasta_exts[-1]))
|
||||
print('\nSkipping the following:\n\t%s' % '\n\t'.join(exemptions))
|
||||
|
||||
# get column names
|
||||
col_values = []
|
||||
@@ -265,8 +267,8 @@ def __main__():
|
||||
del fasta_locs[tr]
|
||||
|
||||
# output results
|
||||
print '\nThere were %s fasta files found that were not included because they did not have the expected file names.' % len(unmatching_fasta_paths)
|
||||
print '%s fasta files were found and listed.\n' % len(fasta_locs.keys())
|
||||
print('\nThere were %s fasta files found that were not included because they did not have the expected file names.' % len(unmatching_fasta_paths))
|
||||
print('%s fasta files were found and listed.\n' % len(fasta_locs.keys()))
|
||||
|
||||
# output unmatching fasta files
|
||||
if options.unmatching_fasta and unmatching_fasta_paths:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
import sys
|
||||
@@ -14,7 +16,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
config_file = read_config_file_arg(sys.argv, 'config/galaxy.ini', 'universe_wsgi.ini')
|
||||
if not os.path.exists(config_file):
|
||||
print "Galaxy config file does not exist (hint: use '-c config.ini' for non-standard locations): %s" % config_file
|
||||
print("Galaxy config file does not exist (hint: use '-c config.ini' for non-standard locations): %s" % config_file)
|
||||
sys.exit(1)
|
||||
repo = 'lib/tool_shed/galaxy_install/migrate'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
convert nt and wgs data (fasta format) to giNumber_seqLen
|
||||
run formatdb in the command line: gunzip -c nt.gz |formatdb -i stdin -p F -n "nt.chunk" -v 2000
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
@@ -19,8 +19,8 @@ if __name__ == '__main__':
|
||||
if len_seq > 0:
|
||||
if gi is None:
|
||||
raise Exception('The first sequence does not have an header.')
|
||||
print ">%s_%d" % (gi, len_seq)
|
||||
print "\n".join(seq)
|
||||
print(">%s_%d" % (gi, len_seq))
|
||||
print("\n".join(seq))
|
||||
title = line
|
||||
fields = title.split('|')
|
||||
if len(fields) >= 2 and fields[0] == '>gi':
|
||||
@@ -34,7 +34,7 @@ if __name__ == '__main__':
|
||||
seq.append(line)
|
||||
len_seq += len(line)
|
||||
if len_seq > 0:
|
||||
print ">%s_%d" % (gi, len_seq)
|
||||
print "\n".join(seq)
|
||||
print(">%s_%d" % (gi, len_seq))
|
||||
print("\n".join(seq))
|
||||
|
||||
print >> sys.stderr, "Unable to find gi number for %d sequences, the title is replaced as giunknown" % (invalid_lines)
|
||||
print("Unable to find gi number for %d sequences, the title is replaced as giunknown" % (invalid_lines), file=sys.stderr)
|
||||
|
||||
@@ -42,6 +42,7 @@ documentation:
|
||||
http://www.crummy.com/software/BeautifulSoup/documentation.html
|
||||
"""
|
||||
from __future__ import generators
|
||||
from __future__ import print_function
|
||||
|
||||
import codecs
|
||||
import re
|
||||
@@ -1807,4 +1808,4 @@ class UnicodeDammit:
|
||||
# By default, act as an HTML pretty-printer.
|
||||
if __name__ == '__main__':
|
||||
soup = BeautifulSoup(sys.stdin.read())
|
||||
print soup.prettify()
|
||||
print(soup.prettify())
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# Dan Blankenberg
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
@@ -12,7 +14,6 @@ def __main__():
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
pass
|
||||
# print "using default base_dir:", base_dir
|
||||
|
||||
organisms = {}
|
||||
for result in os.walk(base_dir):
|
||||
@@ -47,26 +48,26 @@ def __main__():
|
||||
continue
|
||||
if 'build' in org:
|
||||
build = org['build']
|
||||
print "ORG\t%s\t%s\t%s\t%s\t%s\t%s\tUCSC" % (build, org['name'], org['kingdom'], org['group'], org['chromosomes'], org['info url'])
|
||||
print("ORG\t%s\t%s\t%s\t%s\t%s\t%s\tUCSC" % (build, org['name'], org['kingdom'], org['group'], org['chromosomes'], org['info url']))
|
||||
else:
|
||||
print "ORG\t%s\t%s\t%s\t%s\t%s\t%s\tNone" % (build, org['name'], org['kingdom'], org['group'], org['chromosomes'], org['info url'])
|
||||
print("ORG\t%s\t%s\t%s\t%s\t%s\t%s\tNone" % (build, org['name'], org['kingdom'], org['group'], org['chromosomes'], org['info url']))
|
||||
|
||||
for chr in org['chrs']:
|
||||
chr = org['chrs'][chr]
|
||||
print "CHR\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], chr['name'], chr['length'], chr['gi'], chr['gb'], "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=nucleotide&val=" + chr['refseq'])
|
||||
print("CHR\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], chr['name'], chr['length'], chr['gi'], chr['gb'], "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=nucleotide&val=" + chr['refseq']))
|
||||
for feature in ['CDS', 'tRNA', 'rRNA']:
|
||||
print "DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], feature, build, chr['chromosome'], feature, "bed", os.path.join(org['base_dir'], "%s.%s.bed" % (chr['chromosome'], feature)))
|
||||
print("DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], feature, build, chr['chromosome'], feature, "bed", os.path.join(org['base_dir'], "%s.%s.bed" % (chr['chromosome'], feature))))
|
||||
# FASTA
|
||||
print "DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "seq", build, chr['chromosome'], "sequence", "fasta", os.path.join(org['base_dir'], "%s.fna" % chr['chromosome']))
|
||||
print("DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "seq", build, chr['chromosome'], "sequence", "fasta", os.path.join(org['base_dir'], "%s.fna" % chr['chromosome'])))
|
||||
# GeneMark
|
||||
if os.path.exists(os.path.join(org['base_dir'], "%s.GeneMark.bed" % chr['chromosome'])):
|
||||
print "DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "GeneMark", build, chr['chromosome'], "GeneMark", "bed", os.path.join(org['base_dir'], "%s.GeneMark.bed" % chr['chromosome']))
|
||||
print("DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "GeneMark", build, chr['chromosome'], "GeneMark", "bed", os.path.join(org['base_dir'], "%s.GeneMark.bed" % chr['chromosome'])))
|
||||
# GenMarkHMM
|
||||
if os.path.exists(os.path.join(org['base_dir'], "%s.GeneMarkHMM.bed" % chr['chromosome'])):
|
||||
print "DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "GeneMarkHMM", build, chr['chromosome'], "GeneMarkHMM", "bed", os.path.join(org['base_dir'], "%s.GeneMarkHMM.bed" % chr['chromosome']))
|
||||
print("DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "GeneMarkHMM", build, chr['chromosome'], "GeneMarkHMM", "bed", os.path.join(org['base_dir'], "%s.GeneMarkHMM.bed" % chr['chromosome'])))
|
||||
# Glimmer3
|
||||
if os.path.exists(os.path.join(org['base_dir'], "%s.Glimmer3.bed" % chr['chromosome'])):
|
||||
print "DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "Glimmer3", build, chr['chromosome'], "Glimmer3", "bed", os.path.join(org['base_dir'], "%s.Glimmer3.bed" % chr['chromosome']))
|
||||
print("DATA\t%s_%s_%s\t%s\t%s\t%s\t%s\t%s" % (build, chr['chromosome'], "Glimmer3", build, chr['chromosome'], "Glimmer3", "bed", os.path.join(org['base_dir'], "%s.Glimmer3.bed" % chr['chromosome'])))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# Dan Blankenberg
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
@@ -12,7 +14,6 @@ def __main__():
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
pass
|
||||
# print "using default base_dir:", base_dir
|
||||
|
||||
organisms = {}
|
||||
for result in os.walk(base_dir):
|
||||
@@ -55,7 +56,7 @@ def __main__():
|
||||
if swap_test is False:
|
||||
break
|
||||
|
||||
print "||'''Organism'''||'''Kingdom'''||'''Group'''||'''Links to UCSC Archaea Browser'''||"
|
||||
print("||'''Organism'''||'''Kingdom'''||'''Group'''||'''Links to UCSC Archaea Browser'''||")
|
||||
|
||||
for org in orgs:
|
||||
org = organisms[org]
|
||||
@@ -72,7 +73,7 @@ def __main__():
|
||||
if at_ucsc:
|
||||
out_str = out_str + "Yes"
|
||||
out_str = out_str + "||"
|
||||
print out_str
|
||||
print(out_str)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# Dan Blankenberg
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
@@ -11,13 +13,13 @@ def __main__():
|
||||
try:
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
print "using default base_dir:", base_dir
|
||||
print("using default base_dir:", base_dir)
|
||||
|
||||
loc_out = os.path.join(base_dir, "seq.loc")
|
||||
try:
|
||||
loc_out = os.path.join(base_dir, sys.argv[2])
|
||||
except:
|
||||
print "using default seq.loc:", loc_out
|
||||
print("using default seq.loc:", loc_out)
|
||||
|
||||
organisms = {}
|
||||
|
||||
@@ -63,12 +65,12 @@ def __main__():
|
||||
try:
|
||||
os.mkdir(seq_path)
|
||||
except:
|
||||
print "Skipping", build
|
||||
print("Skipping", build)
|
||||
# continue
|
||||
|
||||
loc_out.write("seq %s %s\n" % (build, seq_path))
|
||||
|
||||
# print org info
|
||||
# Print org info
|
||||
|
||||
for chr in org['chrs']:
|
||||
chr = org['chrs'][chr]
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# Dan Blankenberg
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
@@ -12,7 +14,6 @@ def __main__():
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
pass
|
||||
# print "using default base_dir:", base_dir
|
||||
|
||||
organisms = {}
|
||||
for result in os.walk(base_dir):
|
||||
@@ -53,7 +54,7 @@ def __main__():
|
||||
for chrom in org['chrs']:
|
||||
chrom = org['chrs'][chrom]
|
||||
chrs.append("%s=%s" % (chrom['chromosome'], chrom['length']))
|
||||
print "%s\t%s\t%s" % (build, org['name'], ",".join(chrs))
|
||||
print("%s\t%s\t%s" % (build, org['name'], ",".join(chrs)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
# Harvest Bacteria
|
||||
# Connects to NCBI's Microbial Genome Projects website and scrapes it for information.
|
||||
# Downloads and converts annotations for each Genome
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@@ -19,7 +21,7 @@ from util import (
|
||||
get_bed_from_glimmer3
|
||||
)
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
# this defines the types of ftp files we are interested in, and how to process/convert them to a form for our use
|
||||
desired_ftp_files = {'GeneMark': {'ext': 'GeneMark-2.5f', 'parser': 'process_GeneMark'},
|
||||
@@ -55,7 +57,7 @@ def iter_genome_projects(url="http://www.ncbi.nlm.nih.gov/genomes/lproks.cgi?vie
|
||||
try:
|
||||
ftp_url = fields[22].split("href=\"")[1].split("\"")[0]
|
||||
except:
|
||||
print "FAILED TO AQUIRE FTP ADDRESS:", org_num, info_url
|
||||
print("FAILED TO AQUIRE FTP ADDRESS:", org_num, info_url)
|
||||
ftp_url = None
|
||||
|
||||
chroms = get_chroms_by_project_id(org_num)
|
||||
@@ -72,7 +74,7 @@ def get_chroms_by_project_id(org_num, base_url="http://www.ncbi.nlm.nih.gov/entr
|
||||
try:
|
||||
html = requests.get(url).text
|
||||
except:
|
||||
print "GENOME PROJECT FAILED:", html_count, "org:", org_num, url
|
||||
print("GENOME PROJECT FAILED:", html_count, "org:", org_num, url)
|
||||
html = None
|
||||
time.sleep(1) # Throttle Connection
|
||||
if html is None:
|
||||
@@ -131,7 +133,7 @@ def scrape_ftp(ftp_contents, org_dir, org_num, refseq, ftp_url):
|
||||
if items['parser'] is not None:
|
||||
globals()[items['parser']](target_filename, org_num, refseq)
|
||||
else:
|
||||
print "FTP filetype:", file_type, "not found for", org_num, refseq
|
||||
print("FTP filetype:", file_type, "not found for", org_num, refseq)
|
||||
# FTP Files have been Loaded
|
||||
|
||||
|
||||
@@ -169,14 +171,14 @@ def process_Genbank(filename, org_num, refseq):
|
||||
feature_file = open(os.path.join(os.path.split(filename)[0], "%s.%s.bed" % (refseq, feature)), 'wb+')
|
||||
feature_file.write('\n'.join(features[feature]))
|
||||
feature_file.close()
|
||||
print "Genbank extraction finished for chrom:", refseq, "file:", filename
|
||||
print("Genbank extraction finished for chrom:", refseq, "file:", filename)
|
||||
|
||||
|
||||
def process_Glimmer3(filename, org_num, refseq):
|
||||
try:
|
||||
glimmer3_bed = get_bed_from_glimmer3(filename, refseq)
|
||||
except Exception as e:
|
||||
print "Converting Glimmer3 to bed FAILED! For chrom:", refseq, "file:", filename, e
|
||||
print("Converting Glimmer3 to bed FAILED! For chrom:", refseq, "file:", filename, e)
|
||||
glimmer3_bed = []
|
||||
glimmer3_bed_file = open(os.path.join(os.path.split(filename)[0], "%s.Glimmer3.bed" % refseq), 'wb+')
|
||||
glimmer3_bed_file.write('\n'.join(glimmer3_bed))
|
||||
@@ -187,7 +189,7 @@ def process_GeneMarkHMM(filename, org_num, refseq):
|
||||
try:
|
||||
geneMarkHMM_bed = get_bed_from_GeneMarkHMM(filename, refseq)
|
||||
except Exception as e:
|
||||
print "Converting GeneMarkHMM to bed FAILED! For chrom:", refseq, "file:", filename, e
|
||||
print("Converting GeneMarkHMM to bed FAILED! For chrom:", refseq, "file:", filename, e)
|
||||
geneMarkHMM_bed = []
|
||||
geneMarkHMM_bed_bed_file = open(os.path.join(os.path.split(filename)[0], "%s.GeneMarkHMM.bed" % refseq), 'wb+')
|
||||
geneMarkHMM_bed_bed_file.write('\n'.join(geneMarkHMM_bed))
|
||||
@@ -198,7 +200,7 @@ def process_GeneMark(filename, org_num, refseq):
|
||||
try:
|
||||
geneMark_bed = get_bed_from_GeneMark(filename, refseq)
|
||||
except Exception as e:
|
||||
print "Converting GeneMark to bed FAILED! For chrom:", refseq, "file:", filename, e
|
||||
print("Converting GeneMark to bed FAILED! For chrom:", refseq, "file:", filename, e)
|
||||
geneMark_bed = []
|
||||
geneMark_bed_bed_file = open(os.path.join(os.path.split(filename)[0], "%s.GeneMark.bed" % refseq), 'wb+')
|
||||
geneMark_bed_bed_file.write('\n'.join(geneMark_bed))
|
||||
@@ -211,13 +213,13 @@ def __main__():
|
||||
try:
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
print "using default base_dir:", base_dir
|
||||
print("using default base_dir:", base_dir)
|
||||
|
||||
try:
|
||||
os.mkdir(base_dir)
|
||||
print "path '%s' has been created" % base_dir
|
||||
print("path '%s' has been created" % base_dir)
|
||||
except:
|
||||
print "path '%s' seems to already exist" % base_dir
|
||||
print("path '%s' seems to already exist" % base_dir)
|
||||
|
||||
for org_num, name, chroms, kingdom, group, org_genbank, org_refseq, info_url, ftp_url in iter_genome_projects():
|
||||
if chroms is None:
|
||||
@@ -227,7 +229,7 @@ def __main__():
|
||||
org_dir = os.path.join(base_dir, org_num)
|
||||
os.mkdir(org_dir)
|
||||
except:
|
||||
print "Organism %s already exists on disk, skipping" % org_num
|
||||
print("Organism %s already exists on disk, skipping" % org_num)
|
||||
continue
|
||||
|
||||
# get ftp contents
|
||||
@@ -238,7 +240,7 @@ def __main__():
|
||||
for refseq in chroms:
|
||||
scrape_ftp(ftp_contents, org_dir, org_num, refseq, ftp_url)
|
||||
# FTP Files have been Loaded
|
||||
print "Org:", org_num, "chrom:", refseq, "[", time.time() - start_time, "seconds elapsed. ]"
|
||||
print("Org:", org_num, "chrom:", refseq, "[", time.time() - start_time, "seconds elapsed. ]")
|
||||
|
||||
# Create org info file
|
||||
info_file = open(os.path.join(org_dir, "%s.info" % org_num), 'wb+')
|
||||
@@ -251,9 +253,9 @@ def __main__():
|
||||
info_file.write("ftp url=%s\n" % ftp_url)
|
||||
info_file.close()
|
||||
|
||||
print "Finished Harvesting", "[", time.time() - start_time, "seconds elapsed. ]"
|
||||
print "[", (time.time() - start_time) / 60, "minutes. ]"
|
||||
print "[", (time.time() - start_time) / 60 / 60, "hours. ]"
|
||||
print("Finished Harvesting", "[", time.time() - start_time, "seconds elapsed. ]")
|
||||
print("[", (time.time() - start_time) / 60, "minutes. ]")
|
||||
print("[", (time.time() - start_time) / 60 / 60, "hours. ]")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
Walk downloaded Genome Projects and Convert, in place, IDs to match the UCSC Archaea browser, where applicable.
|
||||
Uses UCSC Archaea DSN.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import urllib
|
||||
@@ -15,7 +17,7 @@ def __main__():
|
||||
try:
|
||||
base_dir = sys.argv[1]
|
||||
except:
|
||||
print "using default base_dir:", base_dir
|
||||
print("using default base_dir:", base_dir)
|
||||
|
||||
organisms = {}
|
||||
for result in os.walk(base_dir):
|
||||
@@ -46,28 +48,26 @@ def __main__():
|
||||
try:
|
||||
page = urllib.urlopen(URL)
|
||||
except:
|
||||
print "#Unable to open " + URL
|
||||
print "?\tunspecified (?)"
|
||||
print("#Unable to open " + URL)
|
||||
print("?\tunspecified (?)")
|
||||
sys.exit(1)
|
||||
|
||||
text = page.read()
|
||||
try:
|
||||
tree = ElementTree.fromstring(text)
|
||||
except:
|
||||
print "#Invalid xml passed back from " + URL
|
||||
print "?\tunspecified (?)"
|
||||
print("#Invalid xml passed back from " + URL)
|
||||
print("?\tunspecified (?)")
|
||||
sys.exit(1)
|
||||
|
||||
builds = {}
|
||||
|
||||
# print "#Harvested from http://archaea.ucsc.edu/cgi-bin/das/dsn"
|
||||
# print "?\tunspecified (?)"
|
||||
for dsn in tree:
|
||||
build = dsn.find("SOURCE").attrib['id']
|
||||
try:
|
||||
org_page = urllib.urlopen("http://archaea.ucsc.edu/cgi-bin/hgGateway?db=" + build).read().replace("\n", "").split("<table border=2 cellspacing=2 cellpadding=2>")[1].split("</table>")[0].split("</tr>")
|
||||
except:
|
||||
print "NO CHROMS FOR", build
|
||||
print("NO CHROMS FOR", build)
|
||||
continue
|
||||
org_page.pop(0)
|
||||
if org_page[-1] == "":
|
||||
@@ -82,12 +82,11 @@ def __main__():
|
||||
if org not in builds:
|
||||
builds[org] = {'chrs': {}, 'build': build}
|
||||
builds[org]['chrs'][refseq] = chr
|
||||
# print build,org,chr,refseq
|
||||
|
||||
print
|
||||
print()
|
||||
ext_to_edit = ['bed', 'info', ]
|
||||
for org in builds:
|
||||
print org, "changed to", builds[org]['build']
|
||||
print(org, "changed to", builds[org]['build'])
|
||||
|
||||
# org info file
|
||||
info_file_old = os.path.join(base_dir + org, org + ".info")
|
||||
|
||||
@@ -7,6 +7,8 @@ migrated_tools_conf.xml for tools outside tool panel sections as well as tools i
|
||||
layout of the local tool_conf.xml file. Entries will not be created in migrated_tools_conf.xml for tools included in the tool
|
||||
shed repository but not defined in tool_conf.xml.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -24,6 +26,6 @@ else:
|
||||
file_names = ', '.join(non_shed_tool_confs)
|
||||
msg = "\nThe installation process is finished. All tools associated with this migration that were defined in your file%s named\n" % plural
|
||||
msg += "%s, have been removed. You may now start your Galaxy server.\n" % file_names
|
||||
print msg
|
||||
print(msg)
|
||||
app.shutdown()
|
||||
sys.exit(0)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
Fetch jobs using gops_intersect, gops_merge, gops_subtract, gops_complement, gops_coverage
|
||||
wherein the second dataset doesn't have chr, start and end in standard columns 1, 2 and 3.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import os
|
||||
import sys
|
||||
@@ -13,13 +15,13 @@ import sqlalchemy as sa
|
||||
import galaxy.app
|
||||
import galaxy.model.mapping
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
class TestApplication(object):
|
||||
"""Encapsulates the state of a Universe application"""
|
||||
def __init__(self, database_connection=None, file_path=None):
|
||||
print >> sys.stderr, "python path is: " + ", ".join(sys.path)
|
||||
print("python path is: " + ", ".join(sys.path), file=sys.stderr)
|
||||
if database_connection is None:
|
||||
raise Exception("CleanupDatasetsApplication requires a database_connection value")
|
||||
if file_path is None:
|
||||
@@ -51,16 +53,16 @@ def main():
|
||||
sa.and_(sa.or_(app.model.Job.table.c.tool_id == 'gops_complement_1',
|
||||
app.model.Job.table.c.tool_id == 'gops_merge_1'),
|
||||
sa.not_(app.model.Job.table.c.command_line.like('%-1 1,2,3%')))))).all():
|
||||
print "# processing job id %s" % str(job.id)
|
||||
print("# processing job id %s" % str(job.id))
|
||||
for jtoda in job.output_datasets:
|
||||
print "# --> processing JobToOutputDatasetAssociation id %s" % str(jtoda.id)
|
||||
print("# --> processing JobToOutputDatasetAssociation id %s" % str(jtoda.id))
|
||||
hda = app.model.HistoryDatasetAssociation.get(jtoda.dataset_id)
|
||||
print "# ----> processing HistoryDatasetAssociation id %s" % str(hda.id)
|
||||
print("# ----> processing HistoryDatasetAssociation id %s" % str(hda.id))
|
||||
if not hda.deleted:
|
||||
# Probably don't need this check, since the job state should suffice, but...
|
||||
if hda.dataset.state == 'ok':
|
||||
history = app.model.History.get(hda.history_id)
|
||||
print "# ------> processing history id %s" % str(history.id)
|
||||
print("# ------> processing history id %s" % str(history.id))
|
||||
if history.user_id:
|
||||
cmd_line = str(job.command_line)
|
||||
new_output = tempfile.NamedTemporaryFile('w')
|
||||
@@ -77,7 +79,7 @@ def main():
|
||||
diff_status = os.system('diff %s %s >> /dev/null' % (new_output.name, job_output))
|
||||
if diff_status == 0:
|
||||
continue
|
||||
print "# --------> Outputs differ"
|
||||
print("# --------> Outputs differ")
|
||||
user = app.model.User.get(history.user_id)
|
||||
jobs[job.id] = {}
|
||||
jobs[job.id]['hda_id'] = hda.id
|
||||
@@ -88,20 +90,20 @@ def main():
|
||||
jobs[job.id]['history_update_time'] = history.update_time
|
||||
jobs[job.id]['user_email'] = user.email
|
||||
except Exception as e:
|
||||
print "# caught exception: %s" % str(e)
|
||||
print("# caught exception: %s" % e)
|
||||
|
||||
print "\n\n# Number of incorrect Jobs: %d\n\n" % (len(jobs))
|
||||
print "#job_id\thda_id\thda_name\thda_info\thistory_id\thistory_name\thistory_update_time\tuser_email"
|
||||
print("\n\n# Number of incorrect Jobs: %d\n\n" % (len(jobs)))
|
||||
print("#job_id\thda_id\thda_name\thda_info\thistory_id\thistory_name\thistory_update_time\tuser_email")
|
||||
for jid in jobs:
|
||||
print '%s\t%s\t"%s"\t"%s"\t%s\t"%s"\t"%s"\t%s' % \
|
||||
print('%s\t%s\t"%s"\t"%s"\t%s\t"%s"\t"%s"\t%s' %
|
||||
(str(jid),
|
||||
str(jobs[jid]['hda_id']),
|
||||
jobs[jid]['hda_name'],
|
||||
jobs[jid]['hda_info'],
|
||||
str(jobs[jid]['history_id']),
|
||||
jobs[jid]['history_name'],
|
||||
jobs[jid]['history_update_time'],
|
||||
jobs[jid]['user_email'])
|
||||
str(jobs[jid]['hda_id']),
|
||||
jobs[jid]['hda_name'],
|
||||
jobs[jid]['hda_info'],
|
||||
str(jobs[jid]['history_id']),
|
||||
jobs[jid]['history_name'],
|
||||
jobs[jid]['history_update_time'],
|
||||
jobs[jid]['user_email']))
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
"""
|
||||
Fetch gops_join wherein the use specified minimum coverage is not 1.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import os
|
||||
import sys
|
||||
@@ -12,13 +14,13 @@ import sqlalchemy as sa
|
||||
import galaxy.app
|
||||
import galaxy.model.mapping
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
class TestApplication(object):
|
||||
"""Encapsulates the state of a Universe application"""
|
||||
def __init__(self, database_connection=None, file_path=None):
|
||||
print >> sys.stderr, "python path is: " + ", ".join(sys.path)
|
||||
print("python path is: " + ", ".join(sys.path), file=sys.stderr)
|
||||
if database_connection is None:
|
||||
raise Exception("CleanupDatasetsApplication requires a database_connection value")
|
||||
if file_path is None:
|
||||
@@ -45,16 +47,16 @@ def main():
|
||||
app.model.Job.table.c.state == 'ok',
|
||||
app.model.Job.table.c.tool_id == 'gops_join_1',
|
||||
sa.not_(app.model.Job.table.c.command_line.like('%-m 1 %')))).all():
|
||||
print "# processing job id %s" % str(job.id)
|
||||
print("# processing job id %s" % str(job.id))
|
||||
for jtoda in job.output_datasets:
|
||||
print "# --> processing JobToOutputDatasetAssociation id %s" % str(jtoda.id)
|
||||
print("# --> processing JobToOutputDatasetAssociation id %s" % str(jtoda.id))
|
||||
hda = app.model.HistoryDatasetAssociation.get(jtoda.dataset_id)
|
||||
print "# ----> processing HistoryDatasetAssociation id %s" % str(hda.id)
|
||||
print("# ----> processing HistoryDatasetAssociation id %s" % str(hda.id))
|
||||
if not hda.deleted:
|
||||
# Probably don't need this check, since the job state should suffice, but...
|
||||
if hda.dataset.state == 'ok':
|
||||
history = app.model.History.get(hda.history_id)
|
||||
print "# ------> processing history id %s" % str(history.id)
|
||||
print("# ------> processing history id %s" % str(history.id))
|
||||
if history.user_id:
|
||||
cmd_line = str(job.command_line)
|
||||
new_output = tempfile.NamedTemporaryFile('w')
|
||||
@@ -67,7 +69,7 @@ def main():
|
||||
diff_status = os.system('diff %s %s >> /dev/null' % (new_output.name, job_output))
|
||||
if diff_status == 0:
|
||||
continue
|
||||
print "# --------> Outputs differ"
|
||||
print("# --------> Outputs differ")
|
||||
user = app.model.User.get(history.user_id)
|
||||
jobs[job.id] = {}
|
||||
jobs[job.id]['hda_id'] = hda.id
|
||||
@@ -78,20 +80,20 @@ def main():
|
||||
jobs[job.id]['history_update_time'] = history.update_time
|
||||
jobs[job.id]['user_email'] = user.email
|
||||
except Exception as e:
|
||||
print "# caught exception: %s" % str(e)
|
||||
print("# caught exception: %s" % e)
|
||||
|
||||
print "\n\n# Number of incorrect Jobs: %d\n\n" % (len(jobs))
|
||||
print "#job_id\thda_id\thda_name\thda_info\thistory_id\thistory_name\thistory_update_time\tuser_email"
|
||||
print("\n\n# Number of incorrect Jobs: %d\n\n" % (len(jobs)))
|
||||
print("#job_id\thda_id\thda_name\thda_info\thistory_id\thistory_name\thistory_update_time\tuser_email")
|
||||
for jid in jobs:
|
||||
print '%s\t%s\t"%s"\t"%s"\t%s\t"%s"\t"%s"\t%s' % \
|
||||
print('%s\t%s\t"%s"\t"%s"\t%s\t"%s"\t"%s"\t%s' %
|
||||
(str(jid),
|
||||
str(jobs[jid]['hda_id']),
|
||||
jobs[jid]['hda_name'],
|
||||
jobs[jid]['hda_info'],
|
||||
str(jobs[jid]['history_id']),
|
||||
jobs[jid]['history_name'],
|
||||
jobs[jid]['history_update_time'],
|
||||
jobs[jid]['user_email'])
|
||||
str(jobs[jid]['hda_id']),
|
||||
jobs[jid]['hda_name'],
|
||||
jobs[jid]['hda_info'],
|
||||
str(jobs[jid]['history_id']),
|
||||
jobs[jid]['history_name'],
|
||||
jobs[jid]['history_update_time'],
|
||||
jobs[jid]['user_email']))
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from ConfigParser import ConfigParser
|
||||
@@ -36,15 +38,15 @@ def init():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print 'Loading Galaxy model...'
|
||||
print('Loading Galaxy model...')
|
||||
model, object_store = init()
|
||||
sa_session = model.context.current
|
||||
|
||||
set = 0
|
||||
dataset_count = sa_session.query(model.Dataset).count()
|
||||
print 'Processing %i datasets...' % dataset_count
|
||||
print('Processing %i datasets...' % dataset_count)
|
||||
percent = 0
|
||||
print 'Completed %i%%' % percent,
|
||||
print('Completed %i%%' % percent, end=' ')
|
||||
sys.stdout.flush()
|
||||
for i, dataset in enumerate(sa_session.query(model.Dataset).enable_eagerloads(False).yield_per(1000)):
|
||||
if dataset.total_size is None:
|
||||
@@ -55,8 +57,8 @@ if __name__ == '__main__':
|
||||
new_percent = int(float(i) / dataset_count * 100)
|
||||
if new_percent != percent:
|
||||
percent = new_percent
|
||||
print '\rCompleted %i%%' % percent,
|
||||
print('\rCompleted %i%%' % percent, end=' ')
|
||||
sys.stdout.flush()
|
||||
sa_session.flush()
|
||||
print 'Completed 100%%'
|
||||
print('\rCompleted 100%')
|
||||
object_store.shutdown()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
from ConfigParser import ConfigParser
|
||||
@@ -50,25 +52,25 @@ def init():
|
||||
def quotacheck(sa_session, users, engine):
|
||||
sa_session.refresh(user)
|
||||
current = user.get_disk_usage()
|
||||
print user.username, '<' + user.email + '>:',
|
||||
print(user.username, '<' + user.email + '>:', end=' ')
|
||||
if engine not in ('postgres', 'postgresql'):
|
||||
new = user.calculate_disk_usage()
|
||||
sa_session.refresh(user)
|
||||
# usage changed while calculating, do it again
|
||||
if user.get_disk_usage() != current:
|
||||
print 'usage changed while calculating, trying again...'
|
||||
print('usage changed while calculating, trying again...')
|
||||
return quotacheck(sa_session, user, engine)
|
||||
else:
|
||||
new = pgcalc(sa_session, user.id, dryrun=options.dryrun)
|
||||
# yes, still a small race condition between here and the flush
|
||||
print 'old usage:', nice_size(current), 'change:',
|
||||
print('old usage:', nice_size(current), 'change:', end=' ')
|
||||
if new in (current, None):
|
||||
print 'none'
|
||||
print('none')
|
||||
else:
|
||||
if new > current:
|
||||
print '+%s' % (nice_size(new - current))
|
||||
print('+%s' % (nice_size(new - current)))
|
||||
else:
|
||||
print '-%s' % (nice_size(current - new))
|
||||
print('-%s' % (nice_size(current - new)))
|
||||
if not options.dryrun and engine not in ('postgres', 'postgresql'):
|
||||
user.set_disk_usage(new)
|
||||
sa_session.add(user)
|
||||
@@ -76,17 +78,17 @@ def quotacheck(sa_session, users, engine):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print 'Loading Galaxy model...'
|
||||
print('Loading Galaxy model...')
|
||||
model, object_store, engine = init()
|
||||
sa_session = model.context.current
|
||||
|
||||
if not options.username and not options.email:
|
||||
user_count = sa_session.query(model.User).count()
|
||||
print 'Processing %i users...' % user_count
|
||||
print('Processing %i users...' % user_count)
|
||||
for i, user in enumerate(sa_session.query(model.User).enable_eagerloads(False).yield_per(1000)):
|
||||
print '%3i%%' % int(float(i) / user_count * 100),
|
||||
print('%3i%%' % int(float(i) / user_count * 100), end=' ')
|
||||
quotacheck(sa_session, user, engine)
|
||||
print '100% complete'
|
||||
print('100% complete')
|
||||
object_store.shutdown()
|
||||
sys.exit(0)
|
||||
elif options.username:
|
||||
@@ -94,7 +96,7 @@ if __name__ == '__main__':
|
||||
elif options.email:
|
||||
user = sa_session.query(model.User).enable_eagerloads(False).filter_by(email=options.email).first()
|
||||
if not user:
|
||||
print 'User not found'
|
||||
print('User not found')
|
||||
sys.exit(1)
|
||||
object_store.shutdown()
|
||||
quotacheck(sa_session, user, engine)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
@@ -20,7 +22,7 @@ def main(argv=None):
|
||||
'title': title,
|
||||
'content': content,
|
||||
})
|
||||
print html
|
||||
print(html)
|
||||
open(output, "w").write(html)
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ Add appropriate entries to the Tool Shed's repository registry for a specified r
|
||||
Here is a working example of how to use this script.
|
||||
python ./add_repository_registry_entry.py -a <api key> -u <tool shed url> -n <repository name> -o <repository owner>
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -22,11 +23,11 @@ def main(options):
|
||||
data['owner'] = options.owner
|
||||
url = '%s%s' % (base_tool_shed_url, '/api/repositories/add_repository_registry_entry')
|
||||
response_dict = submit(url, data, api_key=api_key, return_formatted=False)
|
||||
print response_dict
|
||||
print(response_dict)
|
||||
else:
|
||||
print "Invalid tool_shed: ", base_tool_shed_url, " name: ", options.name, " or owner: ", options.owner, "."
|
||||
print("Invalid tool_shed: ", base_tool_shed_url, " name: ", options.name, " or owner: ", options.owner, ".")
|
||||
else:
|
||||
print "An API key for an admin user in the Tool Shed is required to add entries into the Tool Shed's repository registry."
|
||||
print("An API key for an admin user in the Tool Shed is required to add entries into the Tool Shed's repository registry.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@@ -62,15 +64,15 @@ def delete(api_key, url, data, return_formatted=True):
|
||||
response = json.loads(delete_request.read())
|
||||
except urllib2.HTTPError as e:
|
||||
if return_formatted:
|
||||
print e
|
||||
print e.read(1024)
|
||||
print(e)
|
||||
print(e.read(1024))
|
||||
sys.exit(1)
|
||||
else:
|
||||
return dict(status='error', message=str(e.read(1024)))
|
||||
if return_formatted:
|
||||
print 'Response'
|
||||
print '--------'
|
||||
print response
|
||||
print('Response')
|
||||
print('--------')
|
||||
print(response)
|
||||
else:
|
||||
return response
|
||||
|
||||
@@ -80,40 +82,40 @@ def display(url, api_key=None, return_formatted=True):
|
||||
try:
|
||||
r = get(url, api_key=api_key)
|
||||
except urllib2.HTTPError as e:
|
||||
print e
|
||||
print(e)
|
||||
# Only return the first 1K of errors.
|
||||
print e.read(1024)
|
||||
print(e.read(1024))
|
||||
sys.exit(1)
|
||||
if type(r) == unicode:
|
||||
print 'error: %s' % r
|
||||
print('error: %s' % r)
|
||||
return None
|
||||
if not return_formatted:
|
||||
return r
|
||||
elif type(r) == list:
|
||||
# Response is a collection as defined in the REST style.
|
||||
print 'Collection Members'
|
||||
print '------------------'
|
||||
print('Collection Members')
|
||||
print('------------------')
|
||||
for n, i in enumerate(r):
|
||||
# All collection members should have a name in the response.
|
||||
# url is optional
|
||||
if 'url' in i:
|
||||
print '#%d: %s' % (n + 1, i.pop('url'))
|
||||
print('#%d: %s' % (n + 1, i.pop('url')))
|
||||
if 'name' in i:
|
||||
print ' name: %s' % i.pop('name')
|
||||
print(' name: %s' % i.pop('name'))
|
||||
for k, v in i.items():
|
||||
print ' %s: %s' % (k, v)
|
||||
print ''
|
||||
print '%d element(s) in collection' % len(r)
|
||||
print(' %s: %s' % (k, v))
|
||||
print()
|
||||
print('%d element(s) in collection' % len(r))
|
||||
elif type(r) == dict:
|
||||
# Response is an element as defined in the REST style.
|
||||
print 'Member Information'
|
||||
print '------------------'
|
||||
print('Member Information')
|
||||
print('------------------')
|
||||
for k, v in r.items():
|
||||
print '%s: %s' % (k, v)
|
||||
print('%s: %s' % (k, v))
|
||||
elif type(r) == str:
|
||||
print r
|
||||
print(r)
|
||||
else:
|
||||
print 'response is unknown type: %s' % type(r)
|
||||
print('response is unknown type: %s' % type(r))
|
||||
|
||||
|
||||
def get(url, api_key=None):
|
||||
@@ -195,7 +197,7 @@ def json_from_url(url):
|
||||
parsed_json = json.loads(url_contents)
|
||||
except Exception as e:
|
||||
error_message = str(url_contents)
|
||||
print 'Error parsing JSON data in json_from_url(): ', str(e)
|
||||
print('Error parsing JSON data in json_from_url():', e)
|
||||
return None, error_message
|
||||
return parsed_json, error_message
|
||||
|
||||
@@ -242,32 +244,32 @@ def submit(url, data, api_key=None, return_formatted=True):
|
||||
response = post(url, data, api_key=api_key)
|
||||
except urllib2.HTTPError as e:
|
||||
if return_formatted:
|
||||
print e
|
||||
print e.read(1024)
|
||||
print(e)
|
||||
print(e.read(1024))
|
||||
sys.exit(1)
|
||||
else:
|
||||
return dict(status='error', message=str(e.read(1024)))
|
||||
if not return_formatted:
|
||||
return response
|
||||
print 'Response'
|
||||
print '--------'
|
||||
print('Response')
|
||||
print('--------')
|
||||
if type(response) == list:
|
||||
# Currently the only implemented responses are lists of dicts, because submission creates
|
||||
# some number of collection elements.
|
||||
for i in response:
|
||||
if type(i) == dict:
|
||||
if 'url' in i:
|
||||
print i.pop('url')
|
||||
print(i.pop('url'))
|
||||
else:
|
||||
print '----'
|
||||
print('----')
|
||||
if 'name' in i:
|
||||
print ' name: %s' % i.pop('name')
|
||||
print(' name: %s' % i.pop('name'))
|
||||
for k, v in i.items():
|
||||
print ' %s: %s' % (k, v)
|
||||
print(' %s: %s' % (k, v))
|
||||
else:
|
||||
print i
|
||||
print(i)
|
||||
else:
|
||||
print response
|
||||
print(response)
|
||||
|
||||
|
||||
def update(api_key, url, data, return_formatted=True):
|
||||
@@ -279,14 +281,14 @@ def update(api_key, url, data, return_formatted=True):
|
||||
response = put(url, data, api_key=api_key)
|
||||
except urllib2.HTTPError as e:
|
||||
if return_formatted:
|
||||
print e
|
||||
print e.read(1024)
|
||||
print(e)
|
||||
print(e.read(1024))
|
||||
sys.exit(1)
|
||||
else:
|
||||
return dict(status='error', message=str(e.read(1024)))
|
||||
if return_formatted:
|
||||
print 'Response'
|
||||
print '--------'
|
||||
print response
|
||||
print('Response')
|
||||
print('--------')
|
||||
print(response)
|
||||
else:
|
||||
return response
|
||||
|
||||
@@ -17,6 +17,7 @@ available in the test public Tool Shed and create each of them in a local develo
|
||||
|
||||
./create_categories.py -a <api key> -f http://testtoolshed.g2.bx.psu.edu -t http://localhost:9009
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -42,7 +43,7 @@ def main(options):
|
||||
response = submit(url, data, api_key)
|
||||
except Exception as e:
|
||||
response = str(e)
|
||||
print "Error attempting to create category using URL: ", url, " exception: ", str(e)
|
||||
print("Error attempting to create category using URL: ", url, " exception: ", e)
|
||||
create_response_dict = dict(response=response)
|
||||
create_response_dicts.append(create_response_dict)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ are available in the test public Tool Shed and create each of them in a local de
|
||||
|
||||
./create_users.py -a <api key> -f http://testtoolshed.g2.bx.psu.edu -t http://localhost:9009
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -45,7 +46,7 @@ def main(options):
|
||||
response = submit(url, data, api_key)
|
||||
except Exception as e:
|
||||
response = str(e)
|
||||
print "Error attempting to create user using URL: ", url, " exception: ", str(e)
|
||||
print("Error attempting to create user using URL: ", url, " exception: ", e)
|
||||
create_response_dict = dict(response=response)
|
||||
create_response_dicts.append(create_response_dict)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ dependencies from the tool shed into a compressed archive.
|
||||
Here is a working example of how to use this script to export a repository from the tool shed.
|
||||
./export.py --url http://testtoolshed.g2.bx.psu.edu --name chemicaltoolbox --owner bgruening --revision 4133dbf7ff4d --export_repository_dependencies True --download_dir /tmp
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
@@ -85,7 +86,7 @@ def main(options):
|
||||
export_dict = submit(url, data, return_formatted=False)
|
||||
error_messages = export_dict['error_messages']
|
||||
if error_messages:
|
||||
print "Error attempting to export revision ", options.changeset_revision, " of repository ", options.name, " owned by ", options.owner, ":\n", error_messages
|
||||
print("Error attempting to export revision ", options.changeset_revision, " of repository ", options.name, " owned by ", options.owner, ":\n", error_messages)
|
||||
else:
|
||||
export_repository_dependencies = string_as_bool(options.export_repository_dependencies)
|
||||
repositories_archive_filename = \
|
||||
@@ -104,10 +105,10 @@ def main(options):
|
||||
for chunk in src.iter_content(chunk_size=CHUNK_SIZE):
|
||||
if chunk:
|
||||
dst.write(chunk)
|
||||
print "Successfully exported revision ", options.changeset_revision, " of repository ", options.name, " owned by ", options.owner
|
||||
print "to location ", file_path
|
||||
print("Successfully exported revision ", options.changeset_revision, " of repository ", options.name, " owned by ", options.owner)
|
||||
print("to location ", file_path)
|
||||
else:
|
||||
print "Invalid tool_shed / name / owner ."
|
||||
print("Invalid tool_shed / name / owner .")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -19,6 +19,7 @@ This script is useful for analyzing the Tool Shed's install and test framework.
|
||||
Here is a working example of how to use this script.
|
||||
./get_filtered_repository_revisions.py --url http://testtoolshed.g2.bx.psu.edu
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
@@ -54,7 +55,7 @@ def main(options):
|
||||
api_url = get_api_url(base=base_tool_shed_url, parts=parts, params=params)
|
||||
baseline_repository_dicts, error_message = json_from_url(api_url)
|
||||
if baseline_repository_dicts is None or error_message:
|
||||
print error_message
|
||||
print(error_message)
|
||||
else:
|
||||
repository_dicts = []
|
||||
for baseline_repository_dict in baseline_repository_dicts:
|
||||
@@ -62,7 +63,7 @@ def main(options):
|
||||
# module that will generate the install methods.
|
||||
repository_dict, error_message = get_repository_dict(base_tool_shed_url, baseline_repository_dict)
|
||||
if error_message:
|
||||
print 'Error getting additional details from the API: ', error_message
|
||||
print('Error getting additional details from the API: ', error_message)
|
||||
repository_dicts.append(baseline_repository_dict)
|
||||
else:
|
||||
# Don't test empty repositories.
|
||||
@@ -76,8 +77,8 @@ def main(options):
|
||||
repository_dicts.append(dict(repository_dict.items() + baseline_repository_dict.items()))
|
||||
else:
|
||||
repository_dicts.append(dict(repository_dict.items() + baseline_repository_dict.items()))
|
||||
print '\n\n', repository_dicts
|
||||
print '\nThe url:\n\n', api_url, '\n\nreturned ', len(repository_dicts), ' repository dictionaries...'
|
||||
print('\n\n', repository_dicts)
|
||||
print('\nThe url:\n\n', api_url, '\n\nreturned ', len(repository_dicts), ' repository dictionaries...')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -5,6 +5,7 @@ Remove appropriate entries from the Tool Shed's repository registry for a specif
|
||||
Here is a working example of how to use this script.
|
||||
python ./remove_repository_registry_entry.py -a <api key> -u <tool shed url> -n <repository name> -o <repository owner>
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -22,11 +23,11 @@ def main(options):
|
||||
data['owner'] = options.owner
|
||||
url = '%s%s' % (base_tool_shed_url, '/api/repositories/remove_repository_registry_entry')
|
||||
response_dict = submit(url, data, api_key=api_key, return_formatted=False)
|
||||
print response_dict
|
||||
print(response_dict)
|
||||
else:
|
||||
print "Invalid tool_shed: ", base_tool_shed_url, " name: ", options.name, " or owner: ", options.owner, "."
|
||||
print("Invalid tool_shed: ", base_tool_shed_url, " name: ", options.name, " or owner: ", options.owner, ".")
|
||||
else:
|
||||
print "An API key for an admin user in the Tool Shed is required to remove entries from the Tool Shed's repository registry."
|
||||
print("An API key for an admin user in the Tool Shed is required to remove entries from the Tool Shed's repository registry.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -11,6 +11,8 @@ usage: reset_metadata_on_repositories.py key <my_writable>
|
||||
Here is a working example of how to use this script to reset metadata on certain repositories in a specified Tool Shed.
|
||||
python ./reset_metadata_on_repositories.py -a 22be3b -m True -u http://localhost:9009/
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
@@ -56,9 +58,9 @@ def main(options):
|
||||
repository_ids = get(url, api_key)
|
||||
for repository_id in repository_ids:
|
||||
if repository_id in encoded_ids_to_skip:
|
||||
print "--------"
|
||||
print "Skipping repository with id %s because it is in skip file %s" % (str(repository_id), str(skip_file))
|
||||
print "--------"
|
||||
print("--------")
|
||||
print("Skipping repository with id %s because it is in skip file %s" % (repository_id, skip_file))
|
||||
print("--------")
|
||||
else:
|
||||
data = dict(repository_id=repository_id)
|
||||
url = '%s/api/repositories/reset_metadata_on_repository' % base_tool_shed_url
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import optparse
|
||||
import os
|
||||
@@ -75,7 +77,7 @@ def admin_user_info():
|
||||
email = None
|
||||
password = None
|
||||
if tree is None:
|
||||
print "The XML file ", user_info_config, " seems to be invalid, using defaults."
|
||||
print("The XML file ", user_info_config, " seems to be invalid, using defaults.")
|
||||
email = 'admin@test.org'
|
||||
password = 'testuser'
|
||||
username = 'admin'
|
||||
@@ -97,7 +99,7 @@ def get_local_tool_shed_url(config_parser):
|
||||
if config_parser.has_option('server:main', 'port'):
|
||||
port = config_parser.get('server:main', 'port')
|
||||
host = '127.0.0.1'
|
||||
print 'http://%s:%s' % (host, port)
|
||||
print('http://%s:%s' % (host, port))
|
||||
return 0
|
||||
|
||||
|
||||
@@ -113,7 +115,7 @@ def main(args):
|
||||
return check_db(config_parser)
|
||||
elif args.method == 'admin_user_info':
|
||||
(username, email, password) = admin_user_info()
|
||||
print '%s__SEP__%s__SEP__%s' % (username, email, password)
|
||||
print('%s__SEP__%s__SEP__%s' % (username, email, password))
|
||||
return 0
|
||||
elif args.method == 'get_url':
|
||||
return get_local_tool_shed_url(config_parser)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import logging
|
||||
@@ -33,7 +34,7 @@ class BootstrapApplication(object):
|
||||
self.config = config
|
||||
if not self.config.database_connection:
|
||||
self.config.database_connection = "sqlite:///%s?isolation_level=IMMEDIATE" % str(config.database)
|
||||
print 'Using database connection: ', self.config.database_connection
|
||||
print('Using database connection: ', self.config.database_connection)
|
||||
# Setup the database engine and ORM
|
||||
self.model = mapping.init(self.config.file_path,
|
||||
self.config.database_connection,
|
||||
@@ -42,7 +43,7 @@ class BootstrapApplication(object):
|
||||
self.security = security.SecurityHelper(id_secret=self.config.id_secret)
|
||||
self.hgweb_config_manager = self.model.hgweb_config_manager
|
||||
self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir
|
||||
print 'Using hgweb.config file: ', self.hgweb_config_manager.hgweb_config
|
||||
print('Using hgweb.config file: ', self.hgweb_config_manager.hgweb_config)
|
||||
|
||||
@property
|
||||
def sa_session(self):
|
||||
@@ -68,7 +69,7 @@ def create_user(app):
|
||||
if email and password and username:
|
||||
invalid_message = validate(email, password, username)
|
||||
if invalid_message:
|
||||
print invalid_message
|
||||
print(invalid_message)
|
||||
else:
|
||||
user = app.model.User(email=email)
|
||||
user.set_password_cleartext(password)
|
||||
@@ -78,7 +79,7 @@ def create_user(app):
|
||||
app.model.security_agent.create_private_user_role(user)
|
||||
return user
|
||||
else:
|
||||
print "Missing required values for email: ", email, ", password: ", password, ", username: ", username
|
||||
print("Missing required values for email: ", email, ", password: ", password, ", username: ", username)
|
||||
return None
|
||||
|
||||
|
||||
@@ -124,7 +125,7 @@ if __name__ == "__main__":
|
||||
(args, options) = parser.parse_args()
|
||||
ini_file = args.config
|
||||
config_parser = ConfigParser.ConfigParser({'here': os.getcwd()})
|
||||
print "Reading ini file: ", ini_file
|
||||
print("Reading ini file: ", ini_file)
|
||||
config_parser.read(ini_file)
|
||||
config_dict = {}
|
||||
for key, value in config_parser.items("app:main"):
|
||||
@@ -134,7 +135,7 @@ if __name__ == "__main__":
|
||||
user = create_user(app)
|
||||
if user is not None:
|
||||
api_key = create_api_key(app, user)
|
||||
print "Created new user with public username '", user.username, ". An API key was also created and associated with the user."
|
||||
print("Created new user with public username '", user.username, ". An API key was also created and associated with the user.")
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit("Problem creating a new user and an associated API key.")
|
||||
|
||||
@@ -10,6 +10,8 @@ Make sure you adjusted your config to:
|
||||
|
||||
This script expects the Tool Shed's runtime virtualenv to be active.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import logging
|
||||
import os
|
||||
@@ -97,7 +99,6 @@ def build_index(sa_session, whoosh_index_dir, path_to_repositories):
|
||||
full_last_updated=repo.get('full_last_updated'))
|
||||
# Tools get their own index
|
||||
for tool in repo.get('tools_list'):
|
||||
# print tool
|
||||
tool_index_writer.add_document(id=to_unicode(tool.get('id')),
|
||||
name=to_unicode(tool.get('name')),
|
||||
version=to_unicode(tool.get('version')),
|
||||
@@ -107,16 +108,16 @@ def build_index(sa_session, whoosh_index_dir, path_to_repositories):
|
||||
repo_name=to_unicode(repo.get('name')),
|
||||
repo_id=repo.get('id'))
|
||||
tools_indexed += 1
|
||||
print tools_indexed, 'tools (', tool.get('id'), ')'
|
||||
print(tools_indexed, 'tools (', tool.get('id'), ')')
|
||||
|
||||
repos_indexed += 1
|
||||
print repos_indexed, 'repos (', repo.get('id'), ')'
|
||||
print(repos_indexed, 'repos (', repo.get('id'), ')')
|
||||
|
||||
tool_index_writer.commit()
|
||||
repo_index_writer.commit()
|
||||
|
||||
print "TOTAL repos indexed: ", repos_indexed
|
||||
print "TOTAL tools indexed: ", tools_indexed
|
||||
print("TOTAL repos indexed: ", repos_indexed)
|
||||
print("TOTAL tools indexed: ", tools_indexed)
|
||||
|
||||
|
||||
def get_repos(sa_session, path_to_repositories):
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Dan Blankenberg
|
||||
# Script that checks toolshed tags to see if URLs are accessible.
|
||||
# Does not currently handle 'download_binary'
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import urllib2
|
||||
import xml.etree.ElementTree as ET
|
||||
@@ -30,9 +32,9 @@ def main():
|
||||
try:
|
||||
urllib2.urlopen(urllib2.Request(url))
|
||||
except Exception as e:
|
||||
print "Bad URL '%s' in file '%s': %s" % (url, path, e)
|
||||
print("Bad URL '%s' in file '%s': %s" % (url, path, e))
|
||||
except Exception as e:
|
||||
print "Unable to check XML file '%s': %s" % (path, e)
|
||||
print("Unable to check XML file '%s': %s" % (path, e))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
@@ -11,9 +13,9 @@ from tool_shed.util.basic_util import INSTALLATION_LOG
|
||||
def main(args):
|
||||
empty_installation_paths = []
|
||||
if not os.path.exists(args.basepath):
|
||||
print 'Tool dependency path %s does not exist.' % str(args.basepath)
|
||||
print('Tool dependency path "%s" does not exist.' % args.basepath)
|
||||
return 1
|
||||
print 'Checking path %s for empty tool dependency installation directories.' % args.basepath
|
||||
print('Checking path "%s" for empty tool dependency installation directories.' % args.basepath)
|
||||
for root, dirs, files in os.walk(args.basepath):
|
||||
path_parts = root.replace(args.basepath, '').lstrip('/').split(os.sep)
|
||||
# Skip certain special directories.
|
||||
@@ -35,18 +37,18 @@ def main(args):
|
||||
if no_files and no_dirs and root not in empty_installation_paths:
|
||||
empty_installation_paths.append(root)
|
||||
if len(empty_installation_paths) > 0:
|
||||
print 'The following %d tool dependency installation directories were found to be empty or contain only the file %s.' % \
|
||||
(len(empty_installation_paths), INSTALLATION_LOG)
|
||||
print('The following %d tool dependency installation directories were found to be empty or contain only the file %s.' %
|
||||
(len(empty_installation_paths), INSTALLATION_LOG))
|
||||
if args.delete:
|
||||
for path in empty_installation_paths:
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
print 'Deleted %s.' % path
|
||||
print('Deleted %s.' % path)
|
||||
else:
|
||||
for empty_installation_path in empty_installation_paths:
|
||||
print empty_installation_path
|
||||
print(empty_installation_path)
|
||||
else:
|
||||
print 'No empty tool dependency installation directories found.'
|
||||
print('No empty tool dependency installation directories found.')
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
@@ -23,15 +25,15 @@ class BucketList(object):
|
||||
|
||||
def display_empty_installation_paths(self):
|
||||
for empty_installation_path in self.empty_installation_paths:
|
||||
print empty_installation_path
|
||||
print(empty_installation_path)
|
||||
|
||||
def delete_empty_installation_paths(self):
|
||||
print 'Deleting empty installation paths.'
|
||||
print('Deleting empty installation paths.')
|
||||
for empty_installation_path in self.empty_installation_paths:
|
||||
# Get all keys in the S3 bucket that start with the installation path, and delete each one.
|
||||
for path_to_delete in self.bucket.list(prefix=empty_installation_path):
|
||||
self.bucket.delete_key(path_to_delete.key)
|
||||
print 'Deleted empty path %s' % str(empty_installation_path)
|
||||
print('Deleted empty path %s' % empty_installation_path)
|
||||
|
||||
def get_tool_dependency_install_paths(self):
|
||||
found_paths = []
|
||||
@@ -92,22 +94,22 @@ def main(args):
|
||||
if args.s3passwd is not None and os.path.exists(args.s3passwd):
|
||||
awsid, secret = open(args.s3passwd, 'r').read().rstrip('\n').split(':')
|
||||
else:
|
||||
print 'Amazon ID and secret not provided, and no s3passwd file found.'
|
||||
print('Amazon ID and secret not provided, and no s3passwd file found.')
|
||||
return 1
|
||||
else:
|
||||
awsid = args.id
|
||||
secret = args.secret
|
||||
dependency_cleaner = BucketList(awsid, secret, args.bucket)
|
||||
if len(dependency_cleaner.empty_installation_paths) == 0:
|
||||
print 'No empty installation paths found, exiting.'
|
||||
print('No empty installation paths found, exiting.')
|
||||
return 0
|
||||
print 'The following %d tool dependency installation paths were found to be empty or contain only the file %s.' % \
|
||||
(len(dependency_cleaner.empty_installation_paths), INSTALLATION_LOG)
|
||||
print('The following %d tool dependency installation paths were found to be empty or contain only the file %s.' %
|
||||
(len(dependency_cleaner.empty_installation_paths), INSTALLATION_LOG))
|
||||
if asbool(args.delete):
|
||||
dependency_cleaner.delete_empty_installation_paths()
|
||||
else:
|
||||
for empty_installation_path in dependency_cleaner.empty_installation_paths:
|
||||
print empty_installation_path
|
||||
print(empty_installation_path)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
@@ -6,12 +8,12 @@ import sys
|
||||
|
||||
def main(args):
|
||||
if not os.path.exists(args.tool_dependency_dir):
|
||||
print 'Tool dependency base path %s does not exist, creating.' % str(args.tool_dependency_dir)
|
||||
print('Tool dependency base path "%s" does not exist, creating.' % args.tool_dependency_dir)
|
||||
os.mkdir(args.tool_dependency_dir)
|
||||
return 0
|
||||
else:
|
||||
for content in os.listdir(args.tool_dependency_dir):
|
||||
print 'Deleting directory %s from %s.' % (content, args.tool_dependency_dir)
|
||||
print('Deleting directory "%s" from "%s" .' % (content, args.tool_dependency_dir))
|
||||
full_path = os.path.join(args.tool_dependency_dir, content)
|
||||
if os.path.isdir(full_path):
|
||||
shutil.rmtree(full_path)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import logging
|
||||
@@ -26,7 +27,7 @@ from galaxy.util import (
|
||||
log = logging.getLogger()
|
||||
log.setLevel(10)
|
||||
log.addHandler(logging.StreamHandler(sys.stdout))
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def build_citable_url(host, repository):
|
||||
@@ -56,11 +57,11 @@ def main():
|
||||
app = DeprecateRepositoriesApplication(config)
|
||||
cutoff_time = datetime.utcnow() - timedelta(days=options.days)
|
||||
now = strftime("%Y-%m-%d %H:%M:%S")
|
||||
print "\n####################################################################################"
|
||||
print "# %s - Handling stuff older than %i days" % (now, options.days)
|
||||
print("\n####################################################################################")
|
||||
print("# %s - Handling stuff older than %i days" % (now, options.days))
|
||||
|
||||
if options.info_only:
|
||||
print "# Displaying info only ( --info_only )"
|
||||
print("# Displaying info only ( --info_only )")
|
||||
|
||||
deprecate_repositories(app, cutoff_time, days=options.days, info_only=options.info_only, verbose=options.verbose)
|
||||
|
||||
@@ -75,10 +76,10 @@ def send_mail_to_owner(app, name, owner, email, repositories_deprecated, days=14
|
||||
# an environment variable named TOOL_SHED_CANONICAL_URL be set, pointing to the tool shed that is being checked.
|
||||
url = os.environ.get('TOOL_SHED_CANONICAL_URL', None)
|
||||
if None in [smtp_server, from_address]:
|
||||
print '# Mail not configured, not sending email to repository owner.'
|
||||
print('# Mail not configured, not sending email to repository owner.')
|
||||
return
|
||||
elif url is None:
|
||||
print '# Environment variable TOOL_SHED_CANONICAL_URL not set, not sending email to repository owner.'
|
||||
print('# Environment variable TOOL_SHED_CANONICAL_URL not set, not sending email to repository owner.')
|
||||
return
|
||||
subject = "Regarding your tool shed repositories at %s" % url
|
||||
message_body_template = 'The tool shed automated repository checker has discovered that one or more of your repositories hosted ' + \
|
||||
@@ -91,10 +92,10 @@ def send_mail_to_owner(app, name, owner, email, repositories_deprecated, days=14
|
||||
body += '\n'.join([build_citable_url(url, repository) for repository in repositories_deprecated])
|
||||
try:
|
||||
galaxy_send_mail(from_address, repository.user.email, subject, body, app.config)
|
||||
print "# An email has been sent to %s, the owner of %s." % (repository.user.username, ', '.join([repository.name for repository in repositories_deprecated]))
|
||||
print("# An email has been sent to %s, the owner of %s." % (repository.user.username, ', '.join([repository.name for repository in repositories_deprecated])))
|
||||
return True
|
||||
except Exception as e:
|
||||
print "# An error occurred attempting to send email: %s" % str(e)
|
||||
print("# An error occurred attempting to send email: %s" % e)
|
||||
return False
|
||||
|
||||
|
||||
@@ -129,10 +130,10 @@ def deprecate_repositories(app, cutoff_time, days=14, info_only=False, verbose=F
|
||||
.filter(app.model.Repository.table.c.id == repository_id).one()
|
||||
owner = repository.user
|
||||
if info_only:
|
||||
print '# Repository %s owned by %s would have been deprecated, but info_only was set.' % (repository.name, repository.user.username)
|
||||
print('# Repository %s owned by %s would have been deprecated, but info_only was set.' % (repository.name, repository.user.username))
|
||||
else:
|
||||
if verbose:
|
||||
print '# Deprecating repository %s owned by %s.' % (repository.name, owner.username)
|
||||
print('# Deprecating repository %s owned by %s.' % (repository.name, owner.username))
|
||||
if owner.username not in repositories_by_owner:
|
||||
repositories_by_owner[owner.username] = dict(owner=owner, repositories=[])
|
||||
repositories_by_owner[owner.username]['repositories'].append(repository)
|
||||
@@ -146,9 +147,9 @@ def deprecate_repositories(app, cutoff_time, days=14, info_only=False, verbose=F
|
||||
owner = repositories_by_owner[repository_owner]['owner']
|
||||
send_mail_to_owner(app, repository.name, owner.username, owner.email, repositories_by_owner[repository_owner]['repositories'], days)
|
||||
stop = time.time()
|
||||
print '# Deprecated %d repositories.' % len(repositories)
|
||||
print "# Elapsed time: ", stop - start
|
||||
print "####################################################################################"
|
||||
print('# Deprecated %d repositories.' % len(repositories))
|
||||
print("# Elapsed time: ", stop - start)
|
||||
print("####################################################################################")
|
||||
|
||||
|
||||
class DeprecateRepositoriesApplication(object):
|
||||
|
||||
@@ -18,6 +18,8 @@ enable_next_gen_tool_shed = True
|
||||
|
||||
To run this script, use "sh migrate_tools_to_repositories.sh" from this directory
|
||||
'''
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import os
|
||||
import shutil
|
||||
@@ -32,7 +34,7 @@ sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pa
|
||||
|
||||
import galaxy.webapps.tool_shed.app
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def directory_hash_id(id):
|
||||
@@ -83,7 +85,7 @@ def create_repository_from_tool(app, sa_session, tool):
|
||||
# Make the repository name a form of the tool's tool_id by
|
||||
# lower-casing everything and replacing any blank spaces with underscores.
|
||||
repo_name = tool.tool_id.lower().replace(' ', '_')
|
||||
print "Creating repository '%s' in database" % (repo_name)
|
||||
print("Creating repository '%s' in database" % (repo_name))
|
||||
repository = app.model.Repository(name=repo_name,
|
||||
description=tool.description,
|
||||
user_id=tool.user_id)
|
||||
@@ -101,19 +103,19 @@ def create_repository_from_tool(app, sa_session, tool):
|
||||
if not os.path.exists(repository_path):
|
||||
os.makedirs(repository_path)
|
||||
# Create the local hg repository
|
||||
print "Creating repository '%s' on disk" % (os.path.abspath(repository_path))
|
||||
print("Creating repository '%s' on disk" % (os.path.abspath(repository_path)))
|
||||
hg.repository(ui.ui(), os.path.abspath(repository_path), create=True)
|
||||
# Add an entry in the hgweb.config file for the new repository - this enables calls to repository.repo_path
|
||||
add_hgweb_config_entry(repository, repository_path)
|
||||
# Migrate tool categories
|
||||
for tca in tool.categories:
|
||||
category = tca.category
|
||||
print "Associating category '%s' with repository '%s' in database" % (category.name, repository.name)
|
||||
print("Associating category '%s' with repository '%s' in database" % (category.name, repository.name))
|
||||
rca = app.model.RepositoryCategoryAssociation(repository, category)
|
||||
sa_session.add(rca)
|
||||
sa_session.flush()
|
||||
# Migrate tool ratings
|
||||
print "Associating ratings for tool '%s' with repository '%s'" % (tool.name, repository.name)
|
||||
print("Associating ratings for tool '%s' with repository '%s'" % (tool.name, repository.name))
|
||||
for tra in tool.ratings:
|
||||
rra = app.model.RepositoryRatingAssociation(user=tra.user,
|
||||
rating=tra.rating,
|
||||
@@ -167,8 +169,8 @@ def add_tool_files_to_repository(app, sa_session, tool):
|
||||
# Get all valid versions of the tool
|
||||
tool_versions = get_versions(app, tool)
|
||||
for tool_version in tool_versions:
|
||||
print "------------------------------"
|
||||
print "Migrating tool '%s' version '%s' from archive to repository '%s'" % (tool_version.tool_id, tool_version.version, repo_path)
|
||||
print("------------------------------")
|
||||
print("Migrating tool '%s' version '%s' from archive to repository '%s'" % (tool_version.tool_id, tool_version.version, repo_path))
|
||||
# Make a temporary working directory
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
tmp_archive_dir = os.path.join(tmp_dir, 'tmp_archive_dir')
|
||||
@@ -208,13 +210,13 @@ def add_tool_files_to_repository(app, sa_session, tool):
|
||||
for dir in dirs:
|
||||
os.system("hg add %s" % dir)
|
||||
for name in files:
|
||||
print "Adding file '%s' to cloned repository at %s" % (name, str(os.getcwd()))
|
||||
print("Adding file '%s' to cloned repository at %s" % (name, os.getcwd()))
|
||||
os.system("hg add %s" % name)
|
||||
print "Committing change set to cloned repository at %s" % str(os.getcwd())
|
||||
print("Committing change set to cloned repository at %s" % os.getcwd())
|
||||
os.system("hg commit -m 'Migrated tool version %s from old tool shed archive to new tool shed repository'" % tool_version.version)
|
||||
print "Pushing changeset from cloned repository '%s' to repository '%s'" % (cloned_repo_dir, repo_path)
|
||||
print("Pushing changeset from cloned repository '%s' to repository '%s'" % (cloned_repo_dir, repo_path))
|
||||
cmd = "hg push %s" % repo_path
|
||||
print "cmd is: ", cmd
|
||||
print("cmd is: ", cmd)
|
||||
os.system(cmd)
|
||||
# The tool shed includes a repository source file browser, which currently depends upon
|
||||
# copies of the hg repository file store in the repo_path for browsing. We'll do the
|
||||
@@ -266,12 +268,12 @@ def tool_archive_file_name(tool, file_name):
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print "Usage: python %s <Tool shed config file>" % sys.argv[0]
|
||||
print("Usage: python %s <Tool shed config file>" % sys.argv[0])
|
||||
sys.exit(0)
|
||||
now = strftime("%Y-%m-%d %H:%M:%S")
|
||||
print " "
|
||||
print "##########################################"
|
||||
print "%s - Migrating current tool archives to new tool repositories" % now
|
||||
print()
|
||||
print("##########################################")
|
||||
print("%s - Migrating current tool archives to new tool repositories" % now)
|
||||
# tool_shed_wsgi.ini file
|
||||
ini_file = sys.argv[1]
|
||||
conf_parser = ConfigParser.ConfigParser({'here': os.getcwd()})
|
||||
@@ -280,7 +282,7 @@ def main():
|
||||
db_conn_str = conf_parser.get("app:main", "database_connection")
|
||||
except ConfigParser.NoOptionError:
|
||||
db_conn_str = conf_parser.get("app:main", "database_file")
|
||||
print 'DB Connection: ', db_conn_str
|
||||
print('DB Connection: ', db_conn_str)
|
||||
# Instantiate app
|
||||
configuration = {}
|
||||
for key, value in conf_parser.items("app:main"):
|
||||
@@ -290,7 +292,7 @@ def main():
|
||||
# Remove the hgweb.config file if it exists
|
||||
hgweb_config = "%s/hgweb.config" % os.getcwd()
|
||||
if os.path.exists(hgweb_config):
|
||||
print "Removing old file: ", hgweb_config
|
||||
print("Removing old file: ", hgweb_config)
|
||||
os.remove(hgweb_config)
|
||||
repo_records = 0
|
||||
rca_records = 0
|
||||
@@ -300,11 +302,11 @@ def main():
|
||||
# tool files exist in app.config.file_path/tools and we don't want to delete them
|
||||
dir = os.path.join(app.config.file_path, *directory_hash_id(repo.id))
|
||||
if os.path.exists(dir):
|
||||
print "Removing old repository file directory: ", dir
|
||||
print("Removing old repository file directory: ", dir)
|
||||
shutil.rmtree(dir)
|
||||
# Delete all records from db tables:
|
||||
# repository_category_association, repository_rating_association, repository
|
||||
print "Deleting db records for repository: ", repo.name
|
||||
print("Deleting db records for repository: ", repo.name)
|
||||
for rca in repo.categories:
|
||||
sa_session.delete(rca)
|
||||
rca_records += 1
|
||||
@@ -314,9 +316,9 @@ def main():
|
||||
sa_session.delete(repo)
|
||||
repo_records += 1
|
||||
sa_session.flush()
|
||||
print "Deleted %d rows from the repository table" % repo_records
|
||||
print "Deleted %d rows from the repository_category_association table" % rca_records
|
||||
print "Deleted %d rows from the repository_rating_association table" % rra_records
|
||||
print("Deleted %d rows from the repository table" % repo_records)
|
||||
print("Deleted %d rows from the repository_category_association table" % rca_records)
|
||||
print("Deleted %d rows from the repository_rating_association table" % rra_records)
|
||||
# Migrate database tool, tool category and tool rating records to new
|
||||
# database repository, repository category and repository rating records
|
||||
# and create the hg repository on disk for each.
|
||||
@@ -327,9 +329,9 @@ def main():
|
||||
for tool in get_approved_tools(app, sa_session):
|
||||
add_tool_files_to_repository(app, sa_session, tool)
|
||||
app.shutdown()
|
||||
print ' '
|
||||
print 'Migration to next gen tool shed complete...'
|
||||
print "##########################################"
|
||||
print()
|
||||
print('Migration to next gen tool shed complete...')
|
||||
print("##########################################")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
@@ -28,17 +30,17 @@ class CleanUpDependencyApplication(object):
|
||||
|
||||
def main(args, app):
|
||||
if not os.path.exists(args.basepath):
|
||||
print 'Tool dependency base path %s does not exist.' % str(args.basepath)
|
||||
print('Tool dependency base path "%s" does not exist.' % args.basepath)
|
||||
return
|
||||
print 'Checking tool dependency path %s' % args.basepath
|
||||
print('Checking tool dependency path %s' % args.basepath)
|
||||
tool_dependency_dirs = get_tool_dependency_dirs(app)
|
||||
for tool_dependency_dir in tool_dependency_dirs:
|
||||
path = os.path.join(args.basepath, tool_dependency_dir)
|
||||
if os.path.exists(path):
|
||||
path_contents = os.listdir(path)
|
||||
if len(path_contents) > 0:
|
||||
print 'Found non-empty tool dependency installation directory %s.' % path
|
||||
print 'Directory has the following contents: \n %s' % '\n '.join(path_contents)
|
||||
print('Found non-empty tool dependency installation directory %s.' % path)
|
||||
print('Directory has the following contents: \n %s' % '\n '.join(path_contents))
|
||||
|
||||
|
||||
def get_tool_dependency_dirs(app):
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Dan Blankenberg
|
||||
# This script checks maf_index.loc file for inconsistencies between what is listed as available and what is really available.
|
||||
# Make sure that required dependencies (e.g. galaxy_root/lib) are included in your PYTHONPATH
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
import bx.align.maf
|
||||
|
||||
from galaxy.tools.util import maf_utilities
|
||||
|
||||
assert sys.version_info[:2] >= (2, 4)
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
|
||||
|
||||
def __main__():
|
||||
@@ -39,19 +41,19 @@ def __main__():
|
||||
# indexed species
|
||||
for spec in indexed_for_species:
|
||||
if spec not in species_indexed_in_maf:
|
||||
print "Line %i, %s claims to be indexed for %s, but indexes do not exist." % (i, uid, spec)
|
||||
print("Line %i, %s claims to be indexed for %s, but indexes do not exist." % (i, uid, spec))
|
||||
for spec in species_indexed_in_maf:
|
||||
if spec not in indexed_for_species:
|
||||
print "Line %i, %s is indexed for %s, but is not listed in loc file." % (i, uid, spec)
|
||||
print("Line %i, %s is indexed for %s, but is not listed in loc file." % (i, uid, spec))
|
||||
# existing species
|
||||
for spec in species_exist:
|
||||
if spec not in species_found_in_maf:
|
||||
print "Line %i, %s claims to have blocks for %s, but was not found in MAF files." % (i, uid, spec)
|
||||
print("Line %i, %s claims to have blocks for %s, but was not found in MAF files." % (i, uid, spec))
|
||||
for spec in species_found_in_maf:
|
||||
if spec not in species_exist:
|
||||
print "Line %i, %s contains %s, but is not listed in loc file." % (i, uid, spec)
|
||||
print("Line %i, %s contains %s, but is not listed in loc file." % (i, uid, spec))
|
||||
except Exception as e:
|
||||
print "Line %i is invalid: %s" % (i, e)
|
||||
print("Line %i is invalid: %s" % (i, e))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import ConfigParser
|
||||
import os
|
||||
@@ -34,7 +36,7 @@ def create_database(config_file):
|
||||
if database_connection is None:
|
||||
database_connection = 'sqlite:///%s' % parser.get('app:main', 'database_file')
|
||||
if database_connection is None:
|
||||
print 'Unable to determine correct database connection.'
|
||||
print('Unable to determine correct database connection.')
|
||||
exit(1)
|
||||
|
||||
'''Initialize the database file.'''
|
||||
@@ -54,7 +56,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--force', dest='force', action='store_true', help="Use this flag to set the new path even if the file does not (yet) exist there.")
|
||||
opts = parser.parse_args()
|
||||
if not os.path.exists(opts.good_filename) and not opts.force:
|
||||
print 'The file %s does not exist, use the --force option to proceed.' % opts.good_filename
|
||||
print('The file %s does not exist, use the --force option to proceed.' % opts.good_filename)
|
||||
exit(1)
|
||||
session, model = create_database(opts.config_file)
|
||||
exit(main(opts, session, model))
|
||||
|
||||
@@ -49,10 +49,6 @@ class DatasetCollectionManagerTestCase(BaseTestCase, CreatesCollectionsMixin):
|
||||
self.assertFalse(hdca.deleted)
|
||||
self.assertTrue(hdca.visible)
|
||||
|
||||
# print 'hdca dir:'
|
||||
# for k in dir( hdca ):
|
||||
# print k, getattr( hdca, k, '(?)' )
|
||||
|
||||
self.log("should contain an underlying, well-formed DatasetCollection")
|
||||
self.assertIsInstance(hdca.collection, model.DatasetCollection)
|
||||
collection = hdca.collection
|
||||
@@ -61,15 +57,6 @@ class DatasetCollectionManagerTestCase(BaseTestCase, CreatesCollectionsMixin):
|
||||
self.assertEqual(len(collection.dataset_instances), 3)
|
||||
self.assertEqual(len(collection.elements), 3)
|
||||
|
||||
# print 'hdca.collection dir:'
|
||||
# for k in dir( hdca.collection ):
|
||||
# print k, getattr( hdca.collection, k, '(?)' )
|
||||
|
||||
# elements = collection.elements
|
||||
# print 'hdca.collection element dir:'
|
||||
# for k in dir( elements[0] ):
|
||||
# print k, getattr( elements[0], k, '(?)' )
|
||||
|
||||
self.log("and that collection should have three well-formed Elements")
|
||||
self.assertIsInstance(collection.elements[0], model.DatasetCollectionElement)
|
||||
self.assertEqual(collection.elements[0].element_identifier, 'one')
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user