Skip to content
Browse files

allow other extensions except web files for data output

  • Loading branch information...
1 parent 47c38a9 commit 9fb9020738f2c43b4b6a18e6d07ec5bc3285ace2 @rdulepet committed Jun 1, 2010
Showing with 12 additions and 4 deletions.
  1. +9 −3 job.rb
  2. +3 −1 s3_upload.rb
View
12 job.rb
@@ -227,9 +227,15 @@ def store_data
# .html,.htm,.css,.png,.pdf,.jpg
# iterate through directory and store files one at a time in S3
upload_files = Dir[File.join("#{Global.results_dir}/#{@curr_uuid}", "*")].select{|file| File.ftype(file) == "file" &&
- (File.extname(file) == '.crd' ||
- File.extname(file) == '.out' ||
- File.extname(file) == '.sav')}.each{|name|
+ (File.extname(file) != '.jpg' &&
+ File.extname(file) != '.png' &&
+ File.extname(file) != '.gif' &&
+ File.extname(file) != '.html' &&
+ File.extname(file) != '.htm' &&
+ File.extname(file) != '.js' &&
+ File.extname(file) != '.css' &&
+ File.extname(file) != '.pdf' &&
+ File.extname(file) != '.log')}.each{|name|
name = name.split("/").last
if ! @in_data_files.has_key?(name)
puts "DATA_OUTPUT_FILE = #{Global.results_dir}/#{@curr_uuid}/#{name}"
View
4 s3_upload.rb
@@ -26,10 +26,11 @@ def upload_results_to_s3 (server_name, job_id, type, fname, fpath_name)
def upload_data_to_s3 (server_name, job_id, type, fname, fpath_name)
s3_data = ''
+ puts "UPLOAD_DATA_TO_S3::http://#{server_name}/jobs/#{job_id}/uploadurls.xml?upload_type=#{type}&files=#{fname}"
+
response = Net::HTTP.get(URI.parse("http://#{server_name}/jobs/#{job_id}/uploadurls.xml?upload_type=#{type}&files=#{fname}"))
s3_data = XmlSimple.xml_in(response)
- #puts s3_data.inspect
#this is just so we can parse it fast
host = s3_data["files"].first[fname].first['host'].first
@@ -43,6 +44,7 @@ def upload_data_to_s3 (server_name, job_id, type, fname, fpath_name)
end
#create dataset object form path
+ puts "UPLOAD_DATA_TO_S3::CREATE_DATASET::http://#{server_name}/data_sets/create_from_path.xml?name=#{fname}&job_id=#{job_id}&path=#{path}"
Net::HTTP.get(URI.parse("http://#{server_name}/data_sets/create_from_path.xml?name=#{fname}&job_id=#{job_id}&path=#{path}"))
end

0 comments on commit 9fb9020

Please sign in to comment.
Something went wrong with that request. Please try again.