3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/cfbcb00008cb/ Changeset: cfbcb00008cb User: dannon Date: 2014-08-20 15:48:19 Summary: Re-enable administrative job lock, works with multiple handler processes using the internal message queue Affected #: 5 files diff -r 25804ca32d9b3a78a022afa580e574cc6713d2b8 -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -53,6 +53,7 @@ """Start the job manager""" self.app = app self.dispatcher = dispatcher + self.job_lock = False self.sa_session = app.model.context self.track_jobs_in_database = self.app.config.track_jobs_in_database @@ -168,7 +169,10 @@ """ while self.running: try: - self.__monitor_step() + # If jobs are locked, there's nothing to monitor and we skip + # to the sleep. + if not self.job_lock: + self.__monitor_step() except: log.exception( "Exception in monitor_step" ) # Sleep diff -r 25804ca32d9b3a78a022afa580e574cc6713d2b8 -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 lib/galaxy/queue_worker.py --- a/lib/galaxy/queue_worker.py +++ b/lib/galaxy/queue_worker.py @@ -105,5 +105,14 @@ table_names = app.tool_data_tables.reload_tables( table_names=params.get('table_name', None)) log.debug("Finished data table reload for %s" % table_names) + +def admin_job_lock(app, **kwargs): + job_lock = kwargs.get('job_lock', False) + # job_queue is exposed in the root app, but this will be 'fixed' at some + # point, so we're using the reference from the handler. + app.job_manager.job_handler.job_queue.job_lock = job_lock + log.debug("Job dispatching is now set to %s" % job_lock) + control_message_to_task = { 'reload_tool': reload_tool, - 'reload_tool_data_tables': reload_tool_data_tables} + 'reload_tool_data_tables': reload_tool_data_tables, + 'admin_job_lock': admin_job_lock} diff -r 25804ca32d9b3a78a022afa580e574cc6713d2b8 -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 lib/galaxy/queues.py --- a/lib/galaxy/queues.py +++ b/lib/galaxy/queues.py @@ -27,7 +27,8 @@ Refactor later to actually persist this somewhere instead of building it repeatedly. """ - return [Queue('control.%s' % q, galaxy_exchange, routing_key='control') for q in config.server_names] + return [Queue('control.%s' % q, galaxy_exchange, routing_key='control') for + q in config.server_names] def control_queue_from_config(config): diff -r 25804ca32d9b3a78a022afa580e574cc6713d2b8 -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 lib/galaxy/web/base/controllers/admin.py --- a/lib/galaxy/web/base/controllers/admin.py +++ b/lib/galaxy/web/base/controllers/admin.py @@ -1037,6 +1037,7 @@ heap = heap.theone return trans.fill_template( '/admin/memdump.mako', heap = heap, ids = ids, sorts = sorts, breadcrumb = breadcrumb, msg = msg ) + @web.expose @web.require_admin def jobs( self, trans, stop = [], stop_msg = None, cutoff = 180, job_lock = None, ajl_submit = None, **kwd ): @@ -1069,6 +1070,17 @@ msg += ', '.join( deleted ) status = 'done' trans.sa_session.flush() + if ajl_submit: + if job_lock == 'on': + galaxy.queue_worker.send_control_task(trans, 'admin_job_lock', + kwargs={'job_lock': True } ) + job_lock = True + else: + galaxy.queue_worker.send_control_task(trans, 'admin_job_lock', + kwargs={'job_lock': False } ) + job_lock = False + else: + job_lock = trans.app.job_manager.job_handler.job_queue.job_lock cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) ) jobs = trans.sa_session.query( trans.app.model.Job ) \ .filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time, @@ -1089,7 +1101,8 @@ last_updated = last_updated, cutoff = cutoff, msg = msg, - status = status ) + status = status, + job_lock = job_lock) ## ---- Utility methods ------------------------------------------------------- diff -r 25804ca32d9b3a78a022afa580e574cc6713d2b8 -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 templates/admin/jobs.mako --- a/templates/admin/jobs.mako +++ b/templates/admin/jobs.mako @@ -133,3 +133,33 @@ </div></div></form> + +<form name="jobs" action="${h.url_for(controller='admin', action='jobs')}" method="POST"> + <p/> + <div class="toolForm"> + <div class="toolFormTitle"> + Administrative Job Lock + </div> + <div class="toolFormBody"> + <div class="form-row"> + <input type="hidden" name="ajl_submit" value="True"/> + %if job_lock==True: + <p>Job dispatching is currently <strong>locked</strong>.</p> + <label> + <input type='checkbox' name='job_lock' checked='checked' /> + Prevent jobs from dispatching. + </label> + %else: + <p>Job dispatching is currently <strong>unlocked</strong>.</p> + <label> + <input type='checkbox' name='job_lock' /> + Prevent jobs from dispatching. + </label> + %endif + </div> + <div class="form-row"> + <input type="submit" class="primary-button" name="submit" value="Update"> + </div> + </div> + </div> +</form> https://bitbucket.org/galaxy/galaxy-central/commits/b232fa5e0dc4/ Changeset: b232fa5e0dc4 User: dannon Date: 2014-08-20 15:49:00 Summary: Merge. Affected #: 2 files diff -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 -r b232fa5e0dc40ca809ea826a73111e6be8645b95 README.txt --- a/README.txt +++ b/README.txt @@ -1,31 +1,34 @@ -GALAXY -====== -http://galaxyproject.org/ - -The latest information about Galaxy is always available via the Galaxy -website above. - -HOW TO START -============ -Galaxy requires Python 2.6 or 2.7. To check your python version, run: - -% python -V -Python 2.7.3 - -Start Galaxy: - -% sh run.sh - -Once Galaxy completes startup, you should be able to view Galaxy in your -browser at: - -http://localhost:8080 - -You may wish to make changes from the default configuration. This can be done -in the universe_wsgi.ini file. Tools are configured in tool_conf.xml. Details -on adding tools can be found on the Galaxy website (linked above). - -Not all dependencies are included for the tools provided in the sample -tool_conf.xml. A full list of external dependencies is available at: - -https://wiki.galaxyproject.org/Admin/Tools/ToolDependencies +GALAXY +====== +http://galaxyproject.org/ + +The latest information about Galaxy is always available via the Galaxy +website above. + +HOW TO START +============ +Galaxy requires Python 2.6 or 2.7. To check your python version, run: + +% python -V +Python 2.7.3 + +Start Galaxy: + +% sh run.sh + +Once Galaxy completes startup, you should be able to view Galaxy in your +browser at: + +http://localhost:8080 + +You may wish to make changes from the default configuration. This can be done +in the universe_wsgi.ini file. Tools can be either installed from the Tool Shed +or added manually. For details please see the Galaxy wiki: + +https://wiki.galaxyproject.org/Admin/Tools/AddToolFromToolShedTutorial. + + +Not all dependencies are included for the tools provided in the sample +tool_conf.xml. A full list of external dependencies is available at: + +https://wiki.galaxyproject.org/Admin/Tools/ToolDependencies \ No newline at end of file diff -r cfbcb00008cb49126274695cdb3b5bcad0dd7db9 -r b232fa5e0dc40ca809ea826a73111e6be8645b95 lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -1268,6 +1268,7 @@ except: error("That history does not exist.") try: # use a try/finally block to restore the user's current history + default_target_history = trans.get_history() if kwargs: # If kwargs were provided, the states for each step should have # been POSTed @@ -1329,7 +1330,7 @@ trans.sa_session.add( new_history ) target_history = new_history else: - target_history = trans.get_history() + target_history = default_target_history # Build replacement dict for this workflow execution. replacement_dict = {} https://bitbucket.org/galaxy/galaxy-central/commits/a49333fbaf63/ Changeset: a49333fbaf63 User: dannon Date: 2014-08-20 16:31:01 Summary: Clarify job lock log statement, swap loglevel from debug to info. Affected #: 1 file diff -r b232fa5e0dc40ca809ea826a73111e6be8645b95 -r a49333fbaf635b37fd4b96ce89ffc50166b2326e lib/galaxy/queue_worker.py --- a/lib/galaxy/queue_worker.py +++ b/lib/galaxy/queue_worker.py @@ -54,7 +54,7 @@ if body.get('noop', None) != self.app.config.server_name: try: f = self.task_mapping[body['task']] - log.debug("Instance recieved '%s' task, executing now." % body['task']) + log.info("Instance recieved '%s' task, executing now." % body['task']) f(self.app, **body['kwargs']) except Exception: # this shouldn't ever throw an exception, but... @@ -111,7 +111,8 @@ # job_queue is exposed in the root app, but this will be 'fixed' at some # point, so we're using the reference from the handler. app.job_manager.job_handler.job_queue.job_lock = job_lock - log.debug("Job dispatching is now set to %s" % job_lock) + log.info("Administrative Job Lock is now set to %s. Jobs will %s dispatch." + % (job_lock, "not" if job_lock else "now")) control_message_to_task = { 'reload_tool': reload_tool, 'reload_tool_data_tables': reload_tool_data_tables, Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.