Skip to content

Commit

Permalink
adding ignore and default for processor count
Browse files Browse the repository at this point in the history
  • Loading branch information
nllong committed Sep 21, 2013
1 parent fae8b8e commit d21fd1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
/build/
/build_debug/
/build-debug/
Expand Down
4 changes: 4 additions & 0 deletions openstudiocore/ruby/cloud/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# == Usage
#
# ruby aws.rb xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx us-east-1 EC2 launch_server "{\"instance_type\":\"t1.micro\"}"
# ruby aws.rb access_key secret_key us-east-1 EC2 launch_worker "{\"instance_type\":\"t1.micro\"}"
#
# ARGV[0] - Access Key
# ARGV[1] - Secret Key
Expand Down Expand Up @@ -93,7 +94,9 @@ def launch_server
error(-1, "Server status: #{@server.status}")
end


processors = send_command(@server.ip_address, 'nproc | tr -d "\n"')
processors = 0 if processors.nil? # sometimes this returns nothing, so put in a default
@server = create_struct(@server, processors)
end

Expand All @@ -119,6 +122,7 @@ def launch_workers(num, server_ip)

# todo: fix this - sometimes returns nil
processors = send_command(instances[0].ip_address, 'nproc | tr -d "\n"')
processors = 0 if processors.nil? # sometimes this returns nothing, so put in a default
instances.each { |instance| @workers.push(create_struct(instance, processors)) }
end

Expand Down

0 comments on commit d21fd1e

Please sign in to comment.