def configure_instance(options, actions): if "setup_image" in actions: _configure_package_holds(options) configure_MI(env) configure_smtp(options) configure_sudoers(options) if "install_biolinux" in actions: install_biolinux(options) if "purge_tools" in actions: purge_tools() if "setup_tools" in actions: install_tools(options["tools"]) if "purge_genomes" in actions: purge_genomes() if "setup_genomes" in actions: setup_genomes(options) if "purge_galaxy" in actions: purge_galaxy() if "setup_galaxy" in actions: seed = _seed_at_configure_time(options) setup_galaxy(options, seed=seed) if seed: seed_workflows(options) if "setup_ssh_key" in actions: configure_ssh_key(options)
def _setup_vm(options, vm_launcher, actions): destroy_on_complete = get_boolean_option(options, 'destroy_on_complete', False) use_galaxy = get_boolean_option(options, 'use_galaxy', False) try: ip = vm_launcher.get_ip() _setup_fabric(vm_launcher, ip, options) with settings(host_string=ip): _setup_cloudbiolinux(options) if 'attach_volumes' in actions: attach_volumes(vm_launcher, options) if 'max_lifetime' in options: seconds = options['max_lifetime'] # Unclear why the sleep is needed, but seems to be otherwise # this doesn't work. run("bash -c 'nohup sudo shutdown -h %d &'; sleep 2" % seconds) configure_instance(options, actions) do_refresh_galaxy = get_boolean_option(options, 'refresh_galaxy', False) do_upload_genomes = get_boolean_option(options, 'upload_genomes', False) if do_refresh_galaxy: refresh_galaxy(env.galaxy_repository) if use_galaxy: copy_runtime_properties(ip, options) if 'transfer' in actions: transfer_files(options) if do_upload_genomes: upload_genomes(options) if not _seed_at_configure_time(options) and use_galaxy: seed_database() seed_workflows(options) if 'transfer' in actions and use_galaxy: wait_for_galaxy() create_data_library_for_uploads(options) if 'ssh' in actions: _interactive_ssh(vm_launcher) if 'attach_ip' in actions: vm_launcher.attach_public_ip() if 'snapshot_volumes' in actions: make_snapshots(vm_launcher, options) if 'detach_volumes' in actions: detach_volumes(vm_launcher, options) if 'package' in actions: name_template = vm_launcher.package_image_name() name = eval_template(env, name_template) vm_launcher.package(name=name) if not destroy_on_complete: print 'Your Galaxy instance (%s) is waiting at http://%s' % ( vm_launcher.uuid, ip) finally: if destroy_on_complete: vm_launcher.destroy()
def _setup_vm(options, vm_launcher, actions): destroy_on_complete = get_boolean_option(options, 'destroy_on_complete', False) use_galaxy = get_boolean_option(options, 'use_galaxy', False) try: ip = vm_launcher.get_ip() _setup_fabric(vm_launcher, ip, options) with settings(host_string=ip): _setup_cloudbiolinux(options) if 'attach_volumes' in actions: attach_volumes(vm_launcher, options) if 'max_lifetime' in options: seconds = options['max_lifetime'] # Unclear why the sleep is needed, but seems to be otherwise # this doesn't work. run("bash -c 'nohup sudo shutdown -h %d &'; sleep 2" % seconds) configure_instance(options, actions) do_refresh_galaxy = get_boolean_option(options, 'refresh_galaxy', False) do_upload_genomes = get_boolean_option(options, 'upload_genomes', False) if do_refresh_galaxy: refresh_galaxy(env.galaxy_repository) if use_galaxy: copy_runtime_properties(ip, options) if 'transfer' in actions: transfer_files(options) if do_upload_genomes: upload_genomes(options) if not _seed_at_configure_time(options) and use_galaxy: seed_database() seed_workflows(options) if 'transfer' in actions and use_galaxy: wait_for_galaxy() create_data_library_for_uploads(options) if 'ssh' in actions: _interactive_ssh(vm_launcher) if 'attach_ip' in actions: vm_launcher.attach_public_ip() if 'snapshot_volumes' in actions: make_snapshots(vm_launcher, options) if 'detach_volumes' in actions: detach_volumes(vm_launcher, options) if 'package' in actions: name_template = vm_launcher.package_image_name() name = eval_template(env, name_template) vm_launcher.package(name=name) if not destroy_on_complete: print 'Your Galaxy instance (%s) is waiting at http://%s' % (vm_launcher.uuid, ip) finally: if destroy_on_complete: vm_launcher.destroy()