long running tasks
the install for an operating system on a gridcolo virtual machine is a long running process that is started by clicking on a link. this is one way to kick off a long-running process in rails.
def install_os(distro) raise "install on non-root partition attempted." if !root_mount? raise "installation already in progress" if install_progressing? self.distro = "* installing #{distro}" self.save! sys="#{RAILS_ROOT}/script/runner " + "\"DiskPartition.install_os(#{self.id},\'#{distro}\')\" &" unix_shell(sys) end def self.install_os(id, distro) dp = DiskPartition.find(id) raise "installation already in progress" if dp.install_progressing? sys = "ssh #{dp.box.hostname} "+ "/usr/local/bin/gc_install.sh #{dp.mount_code} #{distro}" unix_shell(sys) or raise "OS install failed for distro #{distro} " + "on mount #{mount_code} on box #{box.id}" dp.distro = "#{distro}" dp.save! end
that gets the process started, and leaves an indication that the process is in motion.