Top Level Namespace

Includes:
Cuboid

Defined Under Namespace

Modules: Cuboid Classes: Array, Hash, Object

Constant Summary

Constants included from Cuboid

Cuboid::BANNER, Cuboid::VERSION, Cuboid::WEBSITE

Instance Method Summary collapse

Methods included from Cuboid

collect_young_objects, #get_long_win32_filename, linux?, mac?, null_device, profile?, windows?

Instance Method Details

#agent_connect(*args) ⇒ RPC::Client::Agent

Parameters:

  • url (String)

    URL of the Agent.

  • options (Hash)

    Options for the RPC client.

Returns:



21
22
23
# File 'lib/cuboid/processes/helpers/agents.rb', line 21

def agent_connect( *args )
    Cuboid::Processes::Agents.connect( *args )
end

#agent_kill(*args) ⇒ Object

Parameters:

  • url (String)

    URL of the Agent to kill.



9
10
11
# File 'lib/cuboid/processes/helpers/agents.rb', line 9

def agent_kill( *args )
    Cuboid::Processes::Agents.kill( *args )
end

#agent_killallObject



15
16
17
# File 'lib/cuboid/processes/helpers/agents.rb', line 15

def agent_killall
    Cuboid::Processes::Agents.killall
end

#agent_spawn(*args) ⇒ RPC::Client::Agent

Parameters:

  • options (Hash)

    To be passed to Cuboid::Options#set. Allows ‘address` instead of `rpc_server_address` and `port` instead of `rpc_port`.

Returns:



3
4
5
# File 'lib/cuboid/processes/helpers/agents.rb', line 3

def agent_spawn( *args )
    Cuboid::Processes::Agents.spawn( *args )
end

#ap(obj) ⇒ Object



11
12
13
# File 'lib/cuboid.rb', line 11

def ap( obj )
    super obj, raw: true
end

#instance_agent_spawn(*args) ⇒ RPC::Client::Instance



15
16
17
# File 'lib/cuboid/processes/helpers/instances.rb', line 15

def instance_agent_spawn( *args )
    Cuboid::Processes::Instances.agent.spawn( *args )
end

#instance_connect(*args) ⇒ RPC::Client::Instance

Parameters:

  • url (String)

    URL of the Agent.

  • token (String)

    Authentication token – only need be provided once.

Returns:



31
32
33
# File 'lib/cuboid/processes/helpers/instances.rb', line 31

def instance_connect( *args )
    Cuboid::Processes::Instances.connect( *args )
end

#instance_grid_spawn(*args) ⇒ RPC::Client::Instance

Parameters:

Returns:



9
10
11
# File 'lib/cuboid/processes/helpers/instances.rb', line 9

def instance_grid_spawn( *args )
    Cuboid::Processes::Instances.grid_spawn( *args )
end

#instance_kill(url) ⇒ Object



19
20
21
# File 'lib/cuboid/processes/helpers/instances.rb', line 19

def instance_kill( url )
    Cuboid::Processes::Instances.kill url
end

#instance_killallObject



25
26
27
# File 'lib/cuboid/processes/helpers/instances.rb', line 25

def instance_killall
    Cuboid::Processes::Instances.killall
end

#instance_spawn(*args) ⇒ RPC::Client::Instance, Integer

Returns RPC client and PID.

Parameters:

  • options (Hash)

    To be passed to Cuboid::Options#set. Allows ‘address` instead of `rpc_server_address` and `port` instead of `rpc_port`.

Returns:



3
4
5
# File 'lib/cuboid/processes/helpers/instances.rb', line 3

def instance_spawn( *args )
    Cuboid::Processes::Instances.spawn( *args )
end

#instance_token_for(*args) ⇒ String

Returns Cached authentication token for the given Instance.

Parameters:

Returns:

  • (String)

    Cached authentication token for the given Instance.



37
38
39
# File 'lib/cuboid/processes/helpers/instances.rb', line 37

def instance_token_for( *args )
    Cuboid::Processes::Instances.token_for( *args )
end

#parent_alive?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cuboid/processes/executables/base.rb', line 25

def parent_alive?
    # Windows is not big on POSIX so try it its own way if possible.
    if Gem.win_platform?
        begin
            alive = false
            wmi = WIN32OLE.connect( 'winmgmts://' )
            processes = wmi.ExecQuery( "select ProcessId from win32_process where ProcessID='#{ppid}'")
            processes.each do |proc|
                proc.ole_free
                alive = true
            end
            processes.ole_free
            wmi.ole_free

            return alive
        rescue WIN32OLERuntimeError
        end
    end

    !!(Process.kill( 0, ppid ) rescue false)
end

#ppidObject



21
22
23
# File 'lib/cuboid/processes/executables/base.rb', line 21

def ppid
    $options[:ppid]
end

#process_kill(*args) ⇒ Object

Parameters:

  • pid (Integer)

    PID of the process to kill.



9
10
11
# File 'lib/cuboid/processes/helpers/processes.rb', line 9

def process_kill( *args )
    Cuboid::Processes::Manager.kill( *args )
end

#process_kill_many(*args) ⇒ Object

Parameters:



21
22
23
# File 'lib/cuboid/processes/helpers/processes.rb', line 21

def process_kill_many( *args )
    Cuboid::Processes::Manager.kill_many( *args )
end

#process_kill_reactor(*args) ⇒ Object



3
4
5
# File 'lib/cuboid/processes/helpers/processes.rb', line 3

def process_kill_reactor( *args )
    Cuboid::Processes::Manager.kill_reactor( *args )
end

#process_killall(*args) ⇒ Object



15
16
17
# File 'lib/cuboid/processes/helpers/processes.rb', line 15

def process_killall( *args )
    Cuboid::Processes::Manager.killall( *args )
end

#puts_stderr(str) ⇒ Object



47
48
49
50
51
52
# File 'lib/cuboid/processes/executables/base.rb', line 47

def puts_stderr( str )
    return if $stderr.closed?

    $stderr.puts str
rescue
end

#scheduler_connect(*args) ⇒ RPC::Client::Scheduler

Parameters:

  • url (String)

    URL of the Scheduler.

  • options (Hash)

    Options for the RPC client.

Returns:



21
22
23
# File 'lib/cuboid/processes/helpers/schedulers.rb', line 21

def scheduler_connect( *args )
    Cuboid::Processes::Schedulers.connect( *args )
end

#scheduler_kill(*args) ⇒ Object

Parameters:

  • url (String)

    URL of the Scheduler to kill.



9
10
11
# File 'lib/cuboid/processes/helpers/schedulers.rb', line 9

def scheduler_kill( *args )
    Cuboid::Processes::Schedulers.kill( *args )
end

#scheduler_killallObject



15
16
17
# File 'lib/cuboid/processes/helpers/schedulers.rb', line 15

def scheduler_killall
    Cuboid::Processes::Schedulers.killall
end

#scheduler_spawn(*args) ⇒ RPC::Client::Queue

Parameters:

  • options (Hash)

    To be passed to Cuboid::Options#set. Allows ‘address` instead of `rpc_server_address` and `port` instead of `rpc_port`.

Returns:

  • (RPC::Client::Queue)


3
4
5
# File 'lib/cuboid/processes/helpers/schedulers.rb', line 3

def scheduler_spawn( *args )
    Cuboid::Processes::Schedulers.spawn( *args )
end