Skip to content

Instantly share code, notes, and snippets.

View jmchilton's full-sized avatar

John Chilton jmchilton

  • Penn State University
  • Pittsburgh, PA
  • X @jmchilton
View GitHub Profile
def merge_sorted_iterables( operator, *iterables ):
"""
>>> operator = lambda x: x
>>> list( merge_sorted_iterables( operator, [1,2,3], [4,5] ) )
[1, 2, 3, 4, 5]
>>> list( merge_sorted_iterables( operator, [4, 5], [1,2,3] ) )
[1, 2, 3, 4, 5]
>>> list( merge_sorted_iterables( operator, [1, 4, 5], [2], [3] ) )
[1, 2, 3, 4, 5]
@jmchilton
jmchilton / url_for.traceback
Created February 19, 2014 18:46
url_for trackback
Traceback (most recent call last):
File "/home/john/workspace/galaxy-central/lib/galaxy/jobs/runners/lwr.py", line 161, in __prepare_job
client = self.get_client_from_wrapper(job_wrapper)
File "/home/john/workspace/galaxy-central/lib/galaxy/jobs/runners/lwr.py", line 221, in get_client_from_wrapper
return self.get_client( params, job_id )
File "/home/john/workspace/galaxy-central/lib/galaxy/jobs/runners/lwr.py", line 231, in get_client
files_endpoint = url_for( controller="job_files", job_id=encoded_job_id )
File "/home/john/workspace/galaxy-central/eggs/Routes-1.12.3-py2.7.egg/routes/util.py", line 189, in url_for
encoding = config.mapper.encoding
File "/home/john/workspace/galaxy-central/eggs/Routes-1.12.3-py2.7.egg/routes/__init__.py", line 14, in __getattr__
@jmchilton
jmchilton / job_files.py
Created February 19, 2014 23:13
Job Files API
""" API for asynchronous job running mechanisms can use to fetch or put files
related to running and queued jobs.
"""
import os
import shutil
from galaxy import exceptions
from galaxy import util
from galaxy import model
from galaxy.web.base.controller import BaseAPIController
@jmchilton
jmchilton / more_logging.patch
Created February 26, 2014 14:35
More logging for importing libraries to history.
diff -r fac578cca758 lib/galaxy/webapps/galaxy/controllers/library_common.py
--- a/lib/galaxy/webapps/galaxy/controllers/library_common.py Fri Feb 21 22:09:57 2014 -0600
+++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py Wed Feb 26 08:34:28 2014 -0600
@@ -2001,6 +2001,7 @@
status = 'error'
else:
if new_history_name:
+ log.info("Handling new history.")
new_history = trans.app.model.History()
new_history.name = new_history_name
@jmchilton
jmchilton / lwr_staging.patch
Created February 26, 2014 14:54
Extra debugging during staging.
diff -r c80947795972 lib/galaxy/jobs/runners/lwr_client/staging/up.py
--- a/lib/galaxy/jobs/runners/lwr_client/staging/up.py Fri Feb 21 16:57:59 2014 -0500
+++ b/lib/galaxy/jobs/runners/lwr_client/staging/up.py Wed Feb 26 08:52:07 2014 -0600
@@ -149,7 +149,9 @@
def __upload_input_extra_files(self, input_file):
files_path = "%s_files" % input_file[0:-len(".dat")]
+ log.info( "Extra files path guess is %s, exists? %s" % ( files_path, exists( files_path ) ) )
if exists(files_path) and self.__stage_input(files_path):
+ log.info( "Going to stage extra files - %s" % str(directory_files(files_path)) )
diff -r c80947795972 lib/galaxy/jobs/runners/lwr_client/client.py
--- a/lib/galaxy/jobs/runners/lwr_client/client.py Fri Feb 21 16:57:59 2014 -0500
+++ b/lib/galaxy/jobs/runners/lwr_client/client.py Wed Feb 26 10:55:11 2014 -0600
@@ -9,6 +9,9 @@
MAX_RETRY_COUNT = 5
RETRY_SLEEP_TIME = 0.1
+import logging
+log = logging.getLogger(__name__)
+
@jmchilton
jmchilton / unicode_pbs.patch
Created March 4, 2014 19:21
Fix for passing unicode values to pbs library in Galaxy pbs runner.
diff --git a/lib/galaxy/jobs/runners/pbs.py b/lib/galaxy/jobs/runners/pbs.py
index 6fd577a..22f12a5 100644
--- a/lib/galaxy/jobs/runners/pbs.py
+++ b/lib/galaxy/jobs/runners/pbs.py
@@ -5,6 +5,7 @@ import traceback
from datetime import timedelta
from galaxy import model
+from galaxy import util
from galaxy.util.bunch import Bunch
@jmchilton
jmchilton / pbsdebug.xml
Last active August 29, 2015 13:57
Debug Galaxy tool for PBS/TORQUE GALAXY_SLOTS.
<tool id="pbsdebug" name="PBS DEBUG">
<command>
echo \$GALAXY_SLOTS > $out1;
env > $out3;
echo "No PBS_NODEFILE defined." > $out2;
if [ -f "\$PBS_NODEFILE" ]; then cp \$PBS_NODEFILE $out2; fi
</command>
<inputs>
</inputs>
<outputs>
--- a/getalleleseq.xml Fri Jul 19 17:49:30 2013 -0400
+++ b/getalleleseq.xml Mon Mar 17 10:09:45 2014 -0500
@@ -4,7 +4,6 @@
$alleles
-l $seq_length
-j $major_seq
- -d $__new_file_path__
-p $major_seq.id
</command>
<inputs>
Open Model Questions:
Key:
HDCA - HistoryDatasetCollectionAssociation (connects history and dataset collection)
DC - DatasetCollection
-or-
HDC - HistoryDatasetCollection - combine concepts of HDCA and DC into one.
DCE - DatasetCollectionElement (connects dataset instance or some kind of collection to
a some kind of collection, was called DatasetAssociationDatasetCollectionAssociation