Class: OSC::VNC::Session
- Inherits:
-
Object
- Object
- OSC::VNC::Session
- Includes:
- Listenable
- Defined in:
- lib/osc/vnc/session.rb
Overview
Provides a way for developers to create and submit VNC sessions to the OSC batch systems. Also, developers are now able to submit any server session to the batch systems whether it is VNC or not following the same principles as a VNC session.
Instance Attribute Summary collapse
-
#batch ⇒ PBS::Batch
readonly
The batch object used.
-
#script ⇒ ScriptView
readonly
The batch script used.
Instance Method Summary collapse
-
#initialize(batch, script, opts = {}) ⇒ Session
constructor
A new instance of Session.
-
#submit(opts = {}) ⇒ Session
Submit the VNC job to the defined batch server.
Methods included from Listenable
Constructor Details
#initialize(batch, script, opts = {}) ⇒ Session
Returns a new instance of Session.
21 22 23 24 |
# File 'lib/osc/vnc/session.rb', line 21 def initialize(batch, script, opts = {}) @batch = batch @script = script end |
Instance Attribute Details
#batch ⇒ PBS::Batch (readonly)
Returns The batch object used.
13 14 15 |
# File 'lib/osc/vnc/session.rb', line 13 def batch @batch end |
#script ⇒ ScriptView (readonly)
Returns The batch script used.
16 17 18 |
# File 'lib/osc/vnc/session.rb', line 16 def script @script end |
Instance Method Details
#submit(opts = {}) ⇒ Session
Submit the VNC job to the defined batch server.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/osc/vnc/session.rb', line 33 def submit(opts = {}) script.valid? # check if script is valid (can raise errors here) h = opts.fetch(:headers, {}) r = opts.fetch(:resources, {}) e = opts.fetch(:envvars, {}) # Create tcp listen server if requested listen_server = _create_listen_server(e) if script.tcp_server? id = batch.submit_string( script.render, headers: _get_headers(h), resources: _get_resources(r), envvars: _get_envvars(e) ) _write_listen_conn_info(listen_server) if script.tcp_server? id end |