Method: Cuboid::RPC::Server::ApplicationWrapper#progress

Defined in:
lib/cuboid/rpc/server/application_wrapper.rb

#progress(opts = {}) ⇒ Hash

Provides aggregated progress data.

Parameters:

  • opts (Hash) (defaults to: {})

    Options about what data to include:

Options Hash (opts):

  • :statistics (Bool) — default: true

    Master/merged statistics.

  • :errors (Bool, Integer) — default: false

    Logged errors. If an integer is provided it will return errors past that index.

Returns:

  • (Hash)

    Progress data.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/cuboid/rpc/server/application_wrapper.rb', line 103

def progress( opts = {} )
    opts = opts.my_symbolize_keys

    include_statistics = opts[:statistics].nil? ? true : opts[:statistics]
    include_errors     = opts.include?( :errors ) ?
        (opts[:errors] || 0) : false

    data = {
        status:         status,
        busy:           running?,
        application:    @application.class.to_s,
        seed:           Utilities.random_seed,
        agent_url: Cuboid::Options.agent.url,
        scheduler_url:  Cuboid::Options.scheduler.url
    }

    if include_statistics
        data[:statistics] = @application.statistics
    end

    if include_errors
        data[:errors] =
            errors( include_errors.is_a?( Integer ) ? include_errors : 0 )
    end

    data.merge( messages: status_messages )
end