server/executionhandlers/ruby/connection.rb in cpee-2.1.32 vs server/executionhandlers/ruby/connection.rb in cpee-2.1.33
- old
+ new
@@ -13,10 +13,11 @@
# <http://www.gnu.org/licenses/>.
require 'charlock_holmes'
require 'mimemagic'
require 'base64'
+require 'get_process_mem'
class ConnectionWrapper < WEEL::ConnectionWrapperBase
def self::loop_guard(arguments,id,count) # {{{
controller = arguments[0]
tsn = Time.now
@@ -190,10 +191,11 @@
true
end # }}}
def inform_activity_done # {{{
@controller.notify("activity/done", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
+ @controller.notify("status/resource_utilization", :mib => GetProcessMem.new.mb, **Process.times.to_h)
end # }}}
def inform_activity_manipulate # {{{
@controller.notify("activity/manipulating", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
end # }}}
def inform_activity_failed(err) # {{{
@@ -309,13 +311,17 @@
end
end
end
def callback(result=nil,options={})
- @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result), :annotations => @anno)
+ recv = structurize_result(result)
+ @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv, :annotations => @anno)
@guard_files += result
@handler_returnValue = simplify_result(result)
@handler_returnOptions = options
+ if options['CPEE_EVENT']
+ @controller.notify("task/#{headers['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
+ end
if options['CPEE_UPDATE']
if options['CPEE_UPDATE_STATUS']
@controller.notify("activity/status", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'])
end
@handler_continue.continue WEEL::Signal::Again