rbbt-rest 1.8.13 → 1.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/misc.rb +7 -1
- data/lib/rbbt/rest/workflow/jobs.rb +9 -3
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0849239a178b0971b589cdd302a6f47ece9fe14f
         | 
| 4 | 
            +
              data.tar.gz: 21e387a903f58bd462b2972c708a637b36ccf987
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: dd81011658ccc8782697a636c85aca7c782dbffb3eccd74d7643ae379aa66e67e6e80018bc61609329b75bb9dbdf3b455e22337f996426c45c63ff4b181d35b3
         | 
| 7 | 
            +
              data.tar.gz: 1d8eeb288a895e5c53b1beb10db68fa32b91a7d40abf3bfaa6173ee70359348cb92e2d0c360c5834245954369c11eeb2d4cf52b2c096b682d895b36003fc0959
         | 
| @@ -195,12 +195,18 @@ module RbbtRESTHelpers | |
| 195 195 | 
             
                end
         | 
| 196 196 | 
             
              end
         | 
| 197 197 |  | 
| 198 | 
            -
              def prepare_input(params, input, type)
         | 
| 198 | 
            +
              def prepare_input(params, input, type, stream = false)
         | 
| 199 199 | 
             
                value = consume_parameter(input, params)
         | 
| 200 200 | 
             
                param_file = consume_parameter(input.to_s + '__param_file', params)
         | 
| 201 201 |  | 
| 202 202 | 
             
                param_file, value = value, nil if Hash === value and value.include? :tempfile
         | 
| 203 203 |  | 
| 204 | 
            +
                if stream and param_file
         | 
| 205 | 
            +
                  filename = param_file[:head].match(/filename="(.*?)"\r\n/)[1]
         | 
| 206 | 
            +
                  io = param_file[:tempfile].open
         | 
| 207 | 
            +
                  return ConcurrentStream.setup(io, :filename => filename)
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 204 210 | 
             
                return nil if value.nil? and param_file.nil?
         | 
| 205 211 |  | 
| 206 212 | 
             
                fixed_value = fix_input(type, value, param_file)
         | 
| @@ -52,10 +52,12 @@ module WorkflowRESTHelpers | |
| 52 52 | 
             
              def prepare_job_inputs(workflow, task, params)
         | 
| 53 53 | 
             
                inputs = workflow.task_info(task)[:inputs]
         | 
| 54 54 | 
             
                input_types = workflow.task_info(task)[:input_types]
         | 
| 55 | 
            +
                input_options = workflow.task_info(task)[:input_options]
         | 
| 55 56 |  | 
| 56 57 | 
             
                task_inputs = {}
         | 
| 57 58 | 
             
                inputs.each do |input|
         | 
| 58 | 
            -
                   | 
| 59 | 
            +
                  stream = input_options.include?(input) and input_options[input][:stream]
         | 
| 60 | 
            +
                  task_inputs[input] = prepare_input(params, input, input_types[input], stream)
         | 
| 59 61 | 
             
                end
         | 
| 60 62 |  | 
| 61 63 | 
             
                task_inputs
         | 
| @@ -149,7 +151,7 @@ module WorkflowRESTHelpers | |
| 149 151 | 
             
                end
         | 
| 150 152 | 
             
              end
         | 
| 151 153 |  | 
| 152 | 
            -
              def stream_job(job)
         | 
| 154 | 
            +
              def stream_job(job, job_url = nil)
         | 
| 153 155 | 
             
                unless job.started? or job.done?
         | 
| 154 156 | 
             
                  job.run(:stream) 
         | 
| 155 157 | 
             
                  job.soft_grace
         | 
| @@ -163,6 +165,8 @@ module WorkflowRESTHelpers | |
| 163 165 |  | 
| 164 166 | 
             
                Misc.consume_stream(s, true, sin)
         | 
| 165 167 |  | 
| 168 | 
            +
                headers "RBBT-STREAMING-JOB-URL" =>  job_url if job_url
         | 
| 169 | 
            +
             | 
| 166 170 | 
             
                halt 200, sout
         | 
| 167 171 | 
             
              end
         | 
| 168 172 |  | 
| @@ -184,7 +188,9 @@ module WorkflowRESTHelpers | |
| 184 188 | 
             
                    job.clean 
         | 
| 185 189 | 
             
                  end
         | 
| 186 190 |  | 
| 187 | 
            -
                   | 
| 191 | 
            +
                  job_url = File.join("/", workflow.to_s, task, job.name)
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                  stream_job(job, job_url)
         | 
| 188 194 |  | 
| 189 195 | 
             
                when :synchronous, :sync
         | 
| 190 196 | 
             
                  if update == :reload
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rbbt-rest
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.8. | 
| 4 | 
            +
              version: 1.8.14
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Miguel Vazquez
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-06- | 
| 11 | 
            +
            date: 2016-06-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         |