我正在从命令行运行一个 ruby 脚本。该脚本下载一个文件 (15 MB),将其解压缩,将其解析为 JSON,然后用它填充一个 mysql 数据库。
当我运行它时,我会收到一条简单的“Killed”消息。这是怎么回事?我怎样才能找出问题所在?
我在 EC2 微型实例上使用它。
谢谢
这是脚本
require 'open-uri'
require 'zlib'
require 'json'
require_relative '../db/db.rb'
dl = open('........')
ex = Zlib::GzipReader.new dl
json = JSON.parse ex.read
events = json['resultsPage']['results']['event']
puts "starting to parse #{events.count} event(s)..."
created = 0
updated = 0
events[1..10].each do |event|
performances = event['performance']
performances.each do |performance|
ar_show = Show.find_or_initialize_by_songkick_id performance['id']
ar_show.artist_name = performance['displayName']
ar_show.new_record? ? created += 1 : updated += 1
ar_show.save!
end
end
Import.create :updated => updated, :new => created
puts "complete. new: #{created} - updated: #{updated}"