lib/cloud_crowd/worker.rb in documentcloud-cloud-crowd-0.0.6 vs lib/cloud_crowd/worker.rb in documentcloud-cloud-crowd-0.1.0

- old
+ new

@@ -111,15 +111,18 @@ end # Executes the current work unit, catching all exceptions as failures. def run_work_unit begin + result = nil @action = CloudCrowd.actions[@action_name].new(@status, @input, @options, @store) - result = case @status - when PROCESSING then @action.process - when SPLITTING then @action.split - when MERGING then @action.merge - else raise StatusUnspecified, "work units must specify their status" + Dir.chdir(@action.work_directory) do + result = case @status + when PROCESSING then @action.process + when SPLITTING then @action.split + when MERGING then @action.merge + else raise Error::StatusUnspecified, "work units must specify their status" + end end complete_work_unit({'output' => result}.to_json) rescue Exception => e fail_work_unit(e) end \ No newline at end of file