Class: Pi::Browser::Taskbar::Rails::Broker::Client
- Inherits:
-
Object
- Object
- Pi::Browser::Taskbar::Rails::Broker::Client
- Defined in:
- lib/pi/browser/taskbar/rails/broker.rb
Constant Summary collapse
- CONNECT_ATTEMPTS =
100- CONNECT_DELAY =
0.02
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
Instance Method Summary collapse
- #cancel(task_id) ⇒ Object
- #close ⇒ Object
-
#initialize(project_root:, executable: "pi", task_timeout: 1_800, runtime_root: nil) ⇒ Client
constructor
A new instance of Client.
- #reset ⇒ Object
- #snapshot ⇒ Object
- #submit(task) ⇒ Object
Constructor Details
#initialize(project_root:, executable: "pi", task_timeout: 1_800, runtime_root: nil) ⇒ Client
Returns a new instance of Client.
782 783 784 785 786 787 788 789 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 782 def initialize(project_root:, executable: "pi", task_timeout: 1_800, runtime_root: nil) @identity = Identity.new(project_root, runtime_root: runtime_root) @executable = executable @task_timeout = task_timeout @runtime_root = runtime_root @mutex = Mutex.new @pid = Process.pid end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
791 792 793 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 791 def identity @identity end |
Instance Method Details
#cancel(task_id) ⇒ Object
801 802 803 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 801 def cancel(task_id) request("type" => "cancel", "task_id" => task_id) end |
#close ⇒ Object
809 810 811 812 813 814 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 809 def close reset_after_fork @mutex.synchronize { discard_socket } rescue IOError, SystemCallError @socket = nil end |
#reset ⇒ Object
805 806 807 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 805 def reset request("type" => "reset") end |
#snapshot ⇒ Object
793 794 795 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 793 def snapshot request("type" => "state") end |
#submit(task) ⇒ Object
797 798 799 |
# File 'lib/pi/browser/taskbar/rails/broker.rb', line 797 def submit(task) request("type" => "submit", "task" => task) end |