~cgb-cs/appscale/appscale-main

« back to all changes in this revision

Viewing changes to Neptune/ssa_helper.rb

  • Committer: Chris Bunch
  • Date: 2012-02-26 03:20:57 UTC
  • Revision ID: cgb@cs.ucsb.edu-20120226032057-ad0cy0zgx4we4exc
adding in repo over app engine support, and tests for most of datastore repo on appscale and s3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/ruby
2
2
# Programmer: Chris Bunch
3
 
# baz
4
 
 
 
3
 
 
4
 
 
5
$:.unshift File.join(File.dirname(__FILE__), "..", "AppController")
5
6
require 'djinn'
6
7
 
 
8
 
 
9
$:.unshift File.join(File.dirname(__FILE__), "..", "AppController", "lib")
 
10
require 'datastore_factory'
 
11
 
 
12
 
7
13
MULTICORE = true
8
14
SSA_HOME = "/usr/local/StochKit2.0/"
9
15
 
 
16
 
10
17
IS_FILE = true
11
18
NOT_A_FILE = false
12
19
 
 
20
 
13
21
public 
14
22
 
 
23
 
15
24
def neptune_ssa_run_job(nodes, job_data, secret)
16
25
  return BAD_SECRET_MSG unless valid_secret?(secret)
17
26
  Djinn.log_debug("ssa - run")
41
50
 
42
51
    remote = job_data['@tar']
43
52
    storage = job_data['@storage']
44
 
    creds = Djinn.neptune_parse_creds(storage, job_data)
45
 
 
46
 
    Repo.get_output(remote, storage, creds, tar)
 
53
 
 
54
    datastore = DatastoreFactory.get_datastore(storage, job_data)
 
55
    datastore.get_output_and_save_to_fs(remote, tar)
 
56
 
47
57
    neptune_uncompress_file(tar)
48
58
 
49
59
    num_sims = job_data["@trajectories"] || job_data["@simulations"]
50
 
    #seeds = neptune_get_ssa_seed_vals(num_sims)
51
 
    #Djinn.log_debug("seeds are #{seeds.join(', ')}")
52
60
 
53
61
    param_num = job_data['@param_num']
54
62
 
122
130
              end
123
131
 
124
132
              remote_location = "#{job_data['@output']}/output-#{my_trajectory}"
125
 
              Repo.set_output(remote_location, output, storage, creds, IS_FILE)
 
133
              datastore.write_remote_file_from_local_file(remote_location, output)
126
134
              end_storage = Time.now
127
135
              s_time = end_storage - start_storage
128
136
              total_storage_time += s_time
175
183
    Djinn.log_debug(timing_info)
176
184
 
177
185
    remote_location = "#{job_data['@output']}/timing_info.txt"
178
 
    Repo.set_output(remote_location, timing_info, storage, creds, NOT_A_FILE)
 
186
    datastore.write_remote_file_from_string(remote_location, timing_info)
179
187
 
180
188
    remove_lock_file(job_data)
181
189
  }