| CODENOTIFIER | HelpYou are not signed inSign in |
Project: taskr
Revision: 214
Author: matt.zukowski
Date: 03 Jul 2008 14:04:04
Changes:Added experimental 'dont_wait' parameter to the Taskr4Rails action that forces the remote code to be forked so that it does not hold up the entire server. Currently this will only work if the remote Rails server is running on Mongrel.
Files:| ... | ...@@ -58,13 +58,13 @@ | |
| 58 | 58 | |
| 59 | 59 | def trigger(trigger_args = {}) |
| 60 | 60 | begin |
| 61 | $LOG.info("Executing task #{self.task.name}") | |
| 61 | $LOG.info("Executing task #{self.task.name.inspect}") | |
| 62 | 62 | execute |
| 63 | 63 | task.update_attribute(:last_triggered, Time.now) |
| 64 | 64 | task.update_attribute(:last_triggered_error, nil) |
| 65 | 65 | rescue => e |
| 66 | 66 | puts |
| 67 | $LOG.error(e) | |
| 67 | $LOG.error("Error while executing task #{self.task.name.inspect}! The error was: #{e} (see Taskr log for debugging details)") | |
| 68 | 68 | $LOG.debug(e.backtrace.join($/)) |
| 69 | 69 | details = e.message |
| 70 | 70 | details += "\n\n#{$LAST_ERROR_BODY}" if $LAST_ERROR_BODY # dumb way of reading Restr errors... Restr needs to be fixed |
| ... | ...@@ -95,7 +95,7 @@ | |
| 95 | 95 | |
| 96 | 96 | def trigger(trigger_args = {}) |
| 97 | 97 | begin |
| 98 | $LOG.info("Executing task #{self.task.name}") | |
| 98 | $LOG.info("Executing task #{self.task.name.inspect}") | |
| 99 | 99 | actions.each do |a| |
| 100 | 100 | a.execute |
| 101 | 101 | LogEntry.info(a, "Action #{a} executed.") |
| ... | ...@@ -104,7 +104,7 @@ | |
| 104 | 104 | task.update_attribute(:last_triggered, Time.now) |
| 105 | 105 | task.update_attribute(:last_triggered_error, nil) |
| 106 | 106 | rescue => e |
| 107 | $LOG.error(e) | |
| 107 | $LOG.error("Error while executing task #{self.task.name.inspect}! The error was: #{e} (see Taskr log for debugging details)") | |
| 108 | 108 | $LOG.debug("#{e.backtrace}") |
| 109 | 109 | task.update_attribute(:last_triggered, Time.now) |
| 110 | 110 | task.update_attribute(:last_triggered_error, {:type => e.class.to_s, :details => "#{e.message}"}) |
| ... | ...@@ -296,11 +296,13 @@ | |
| 296 | 296 | end |
| 297 | 297 | |
| 298 | 298 | class Taskr4rails < Base |
| 299 | self.parameters = ['url', 'auth', 'ruby_code']#, 'shell_command'] | |
| 299 | self.parameters = ['url', 'auth', 'ruby_code', 'dont_wait']#, 'shell_command'] | |
| 300 | 300 | self.description = "Executes code on a remote Rails server via the taskr4rails plugin." |
| 301 | 301 | |
| 302 | 302 | def execute |
| 303 | 303 | data = { |
| 304 | :task_name => task.name, | |
| 305 | :task_id => task.id, | |
| 304 | 306 | :auth => parameters['auth'], |
| 305 | 307 | :ruby_code => parameters['ruby_code']#, |
| 306 | 308 | #:shell_command => parameters['shell_command'] |