source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/account_info.rb | Ruby | mit | 19 | master | 721 | module OodCore
module Job
class AccountInfo
include OodCore::DataFormatter
# The name of the account.
attr_reader :name
alias to_s name
# The QoS values this account can use.
attr_reader :qos
# the cluser this account comes from.
attr_reader :cluster
def... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/array_ids.rb | Ruby | mit | 19 | master | 985 | module OodCore
module Job
# Builds a sorted array of job ids given a job array spec string
#
# Job array spec strings:
# 1 Single id
# 1-10 Range
# 1-10:2 Range with step
# 1-10,13 Compound (range with single id)
#
# Note that Ranges are expected to be inc... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapter.rb | Ruby | mit | 19 | master | 10,444 | module OodCore
module Job
# A class that handles the communication with a resource manager for
# submitting/statusing/holding/deleting jobs
# @abstract
class Adapter
using Refinements::ArrayExtensions
# Submit a job with the attributes defined in the job template instance
# @abstrac... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/cluster_info.rb | Ruby | mit | 19 | master | 1,157 | module OodCore
module Job
# An object that contains details about the cluster's active and total nodes, processors and gpus.
class ClusterInfo
using Refinements::HashExtensions
attr_reader :active_nodes, :total_nodes, :active_processors, :total_processors, :active_gpu_nodes,
:to... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/factory.rb | Ruby | mit | 19 | master | 1,496 | require "ood_core/refinements/hash_extensions"
module OodCore
module Job
# A factory that builds job adapter objects from a configuration.
class Factory
using Refinements::HashExtensions
class << self
# Build a job adapter from a configuration
# @param config [#to_h] configuratio... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/queue_info.rb | Ruby | mit | 19 | master | 1,508 | # frozen_string_literal: true
# QueueInfo is information about a given queue on a scheduler.
class OodCore::Job::QueueInfo
include OodCore::DataFormatter
# The name of the queue.
attr_reader :name
alias to_s name
# The QoSes associated with this queue
attr_reader :allow_qos
attr_reader :deny_qos
# ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/task.rb | Ruby | mit | 19 | master | 527 | module OodCore
module Job
class Task
attr_reader :id, :status, :wallclock_time
def initialize(id:, status:, wallclock_time: nil, **_)
@id = id.to_s
@status = OodCore::Job::Status.new(state: status)
@wallclock_time = wallclock_time && wallclock_time.to_i
end
def to... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/status.rb | Ruby | mit | 19 | master | 3,942 | module OodCore
module Job
# An object that describes the current state of a submitted job.
class Status
class << self
# Possible states a submitted job can be in:
# # Job status cannot be determined
# :undetermined
#
# # Job is queued for being scheduled and... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/script.rb | Ruby | mit | 19 | master | 10,388 | require 'pathname'
require 'time'
require 'ood_core/refinements/array_extensions'
module OodCore
module Job
# An object that describes a batch job before it is submitted. This includes
# the resources this batch job will require of the resource manager.
class Script
using Refinements::ArrayExtensio... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/info.rb | Ruby | mit | 19 | master | 6,714 | require 'time'
module OodCore
module Job
# An object that describes a submitted job.
class Info
# The identifier of the job
# @return [String] job id
attr_reader :id
# The status of the job
# @return [Status] job state
attr_reader :status
# Set of machines that is ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/node_info.rb | Ruby | mit | 19 | master | 1,612 | module OodCore
module Job
# An object that describes the resources used on a specific node.
class NodeInfo
# The name of the host machine
# @return [String] node name
attr_reader :name
# The number of procs reserved on the given machine
# @return [Integer, nil] number of procs
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/torque.rb | Ruby | mit | 19 | master | 17,322 | require "ood_core/refinements/hash_extensions"
require "ood_core/job/adapters/helper"
require 'shellwords'
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Torque adapter from a configuration
# @param config [#to_h] the configuration for job adapter
#... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/kubernetes.rb | Ruby | mit | 19 | master | 8,222 | require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
def self.build_kubernetes(config)
batch = Adapters::Kubernetes::Batch.new(config.to_h.symbolize_keys)
Adapters::Kub... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/psij.rb | Ruby | mit | 19 | master | 15,276 | require "time"
require 'etc'
require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
require 'json'
require 'pathname'
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the PSIJ adapter from a ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/linux_host.rb | Ruby | mit | 19 | master | 10,567 | require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
require "set"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the LinuxHost adapter from a configuration
# @param config [#to_... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/ccq.rb | Ruby | mit | 19 | master | 9,913 | require "ood_core/job/adapters/helper"
require "tempfile"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Cloudy Cluster adapter from a configuration
# @param config [#to_h] the configuration for job adapter
# @option config [Object] :image (nil) The... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/lsf.rb | Ruby | mit | 19 | master | 9,698 | require "ood_core/refinements/hash_extensions"
require "ood_core/job/adapters/helper"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Lsf adapter from a configuration
# @param config [#to_h] the configuration for job adapter
# @option config [#to_s] ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/coder.rb | Ruby | mit | 19 | master | 4,860 | require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require 'net/http'
require 'etc'
module OodCore
module Job
class Factory
using Refinements::HashExtensions
require "ood_core/job/adapters/coder/openstack_credentials"
def self.build_coder(config)
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/htcondor.rb | Ruby | mit | 19 | master | 29,887 | require "time"
require 'etc'
require 'tempfile'
require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the HTCondor adapt... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/helper.rb | Ruby | mit | 19 | master | 2,275 | module OodCore
module Job
module Adapters
# @api private
class Helper
# Get the configured path to a command allowing overrides from bin_overrides
# @param cmd [String] the desired command
# @param bin_default [String] the default place to find cmd on the file system
# ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/drmaa.rb | Ruby | mit | 19 | master | 38,935 | #!/usr/bin/ruby
#########################################################################
#
# The Contents of this file are made available subject to the terms of
# the Sun Industry Standards Source License Version 1.2
#
# Sun Microsystems Inc., March, 2006
#
#
# Sun Industry Standards Source License Version 1.2
#... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/systemd.rb | Ruby | mit | 19 | master | 9,509 | require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
require "set"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the LinuxSystemd adapter from a configuration
# @param config [#... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/pbspro.rb | Ruby | mit | 19 | master | 23,964 | require "time"
require "json"
require "ood_core/refinements/hash_extensions"
require "ood_core/job/adapters/helper"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the PBS Pro adapter from a configuration
# @param config [#to_h] the configuration for job adapt... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/sge.rb | Ruby | mit | 19 | master | 6,743 | require "ood_core/refinements/array_extensions"
require "ood_core/refinements/hash_extensions"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Sun Grid Engine adapter from a configuration
# @param config [#to_h] the configuration for job adapter
# @o... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/slurm.rb | Ruby | mit | 19 | master | 41,112 | require "time"
require 'etc'
require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Slurm adapter from a configuration
# @param c... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/fujitsu_tcs.rb | Ruby | mit | 19 | master | 17,596 | require "time"
require "ood_core/refinements/hash_extensions"
require "ood_core/refinements/array_extensions"
require "ood_core/job/adapters/helper"
module OodCore
module Job
class Factory
using Refinements::HashExtensions
# Build the Fujitsu TCS (Technical Computing Suite) adapter from a conf... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/sge/batch.rb | Ruby | mit | 19 | master | 8,654 | # Patch to allow runtime setting of the libdrmaa path
module FFI_DRMAA
def self.libdrmaa_path
@libdrmaa_path || 'libdrmaa.so'
end
def self.libdrmaa_path=(path)
@libdrmaa_path = path
end
end
# Object used for simplified communication with a SGE batch server
#
# @api private
class OodCore::Job::Adapte... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/sge/qstat_xml_j_r_listener.rb | Ruby | mit | 19 | master | 5,810 | require 'rexml/document'
require 'rexml/streamlistener'
require 'date'
require 'ood_core'
require 'ood_core/job/array_ids'
# An XML stream listener to build an array of OodCore::Job::Info from qstat output
#
# Handles parsing `qstat -xml -r -j` which provides:
# :accounting_id
# :id
# :job_name
# :job_owner
# :procs
#... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/sge/qstat_xml_r_listener.rb | Ruby | mit | 19 | master | 4,051 | require 'rexml/document'
require 'rexml/streamlistener'
require 'date'
# An XML stream listener to build an array of OodCore::Job::Info from qstat output
#
# Handles parsing `qstat -xml -r` which provides:
# :accounting_id
# :id
# :job_name
# :job_owner
# :procs
# :queue_name
# :status
# :wallclock_limit
class QstatXm... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/sge/helper.rb | Ruby | mit | 19 | master | 4,546 | # Utility helper class for the SGE adapter to parse
# input and generate submission arguements.
class OodCore::Job::Adapters::Sge::Helper
require 'ood_core/job/adapters/sge'
using OodCore::Refinements::ArrayExtensions
# Convert seconds to duration
# @param time [#to_i]
# @return [String] an SGE qsub compati... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/torque/ffi.rb | Ruby | mit | 19 | master | 16,564 | require 'ffi'
# An interface to the C-library of Torque.
class OodCore::Job::Adapters::Torque::FFI
extend ::FFI::Library
# @!attribute [rw] self.pbs_errno
# The internal PBS error number
# int pbs_errno
# @return [Fixnum] pbs error number
# @!attribute [r] self.pbs_server
# The PBS server na... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/torque/attributes.rb | Ruby | mit | 19 | master | 3,844 | # Utility class to maintain all the Torque attributes available.
class OodCore::Job::Adapters::Torque
# Maintains a constant Hash of defined PBS attribute types
# Includes:
# Attribute names used by user commands
# Additional job and general attribute names
# Additional queue attribute names
# Addit... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/torque/error.rb | Ruby | mit | 19 | master | 9,708 | # FFI errors for the Torque adapter.
class OodCore::Job::Adapters::Torque::FFI
# The root exception class that all PBS-specific exceptions inherit from
class Error < StandardError; end
# Unknown job ID error
class UnkjobidError < Error; end
# Undefined attribute
class NoattrError < Error; end
# Cannot ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/torque/batch.rb | Ruby | mit | 19 | master | 16,750 | require 'open3'
# Utility class for the Torque adapter to communicate with the
# Torque scheduler.
class OodCore::Job::Adapters::Torque
# Object used for simplified communication with a batch server
class Batch
# The host of the Torque batch server
# @example OSC's Oakley batch server
# my_conn.host ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/kubernetes/resources.rb | Ruby | mit | 19 | master | 4,102 | module OodCore::Job::Adapters::Kubernetes::Resources
# Utility class for kubernetes configmap objects.
class ConfigMap
attr_accessor :name, :files
def initialize(name, files)
@name = name
@files = []
files.each do |f|
@files << ConfigMapFile.new(f)
end
end
def mount... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/kubernetes/k8s_job_info.rb | Ruby | mit | 19 | master | 305 | # An object that describes a submitted kubernetes job with extended information.
class OodCore::Job::Adapters::Kubernetes::K8sJobInfo < OodCore::Job::Info
attr_reader :ood_connection_info
def initialize(options)
super(**options)
@ood_connection_info = options[:ood_connection_info]
end
end |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/kubernetes/helper.rb | Ruby | mit | 19 | master | 10,667 | # Utility class for the Kubernetes adapter to parse
# json data into Ruby objects.
class OodCore::Job::Adapters::Kubernetes::Helper
require_relative 'resources'
require_relative 'k8s_job_info'
require 'resolv'
require 'base64'
require 'ood_core/refinements/hash_extensions'
using OodCore::Refinements::Hash... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/kubernetes/batch.rb | Ruby | mit | 19 | master | 10,419 | require "ood_core/refinements/hash_extensions"
require "json"
# Utility class for the Kubernetes adapter to interact
# with the Kuberenetes APIs.
class OodCore::Job::Adapters::Kubernetes::Batch
require_relative "helper"
require_relative "k8s_job_info"
using OodCore::Refinements::HashExtensions
class Error <... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/coder/credentials.rb | Ruby | mit | 19 | master | 459 | class CredentialsInterface
def load_credentials
raise NotImplementedError, "#{self.class} must implement #{__method__}"
end
def generate_credentials
raise NotImplementedError, "#{self.class} must implement #{__method__}"
end
def destroy_credentials
raise NotImplementedError, "#{self.class} must ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/coder/coder_job_info.rb | Ruby | mit | 19 | master | 234 | class OodCore::Job::Adapters::Coder::CoderJobInfo < OodCore::Job::Info
attr_reader :ood_connection_info
def initialize(options)
super(**options)
@ood_connection_info = options[:ood_connection_info]
end
end |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/coder/openstack_credentials.rb | Ruby | mit | 19 | master | 3,632 | require "fog/openstack"
require "json"
require "ood_core/job/adapters/coder/credentials"
require "tempfile"
require 'excon'
class OpenStackCredentials < CredentialsInterface
def initialize(auth_url, dir)
@auth_url = auth_url
@dir = dir
end
def load_credentials(id)
JSON.parse(File.read(file_path(id))... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/coder/batch.rb | Ruby | mit | 19 | master | 7,152 | require "ood_core/refinements/hash_extensions"
require "json"
# Utility class for the Coder adapter to interact with the Coders API.
class OodCore::Job::Adapters::Coder::Batch
require_relative "coder_job_info"
class Error < StandardError; end
def initialize(config, credentials)
@host = config[:host]
@tok... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/lsf/batch.rb | Ruby | mit | 19 | master | 6,312 | # Object used for simplified communication with a LSF batch server
#
# @api private
class OodCore::Job::Adapters::Lsf::Batch
attr_reader :bindir, :libdir, :envdir, :serverdir, :cluster, :bin_overrides, :submit_host, :strict_host_checking
# The root exception class that all LSF-specific exceptions inherit
# from
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/lsf/helper.rb | Ruby | mit | 19 | master | 4,289 | # Object used for simplified communication with a LSF batch server
#
# @api private
class OodCore::Job::Adapters::Lsf::Helper
# convert string in format "03/31-14:46:42" to Time object
# assumes time being parsed is a time that ocurred in the past
# not to be used for parsing times in the future (like estimated ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/systemd/launcher.rb | Ruby | mit | 19 | master | 8,154 | require 'erb'
require 'etc'
require 'pathname'
require 'securerandom'
require 'shellwords'
require 'time'
# Object used for simplified communication SSH hosts
#
# @api private
class OodCore::Job::Adapters::LinuxSystemd::Launcher
attr_reader :debug, :site_timeout, :session_name_label, :ssh_hosts,
:strict_host_che... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/job/adapters/linux_host/launcher.rb | Ruby | mit | 19 | master | 10,273 | require 'erb'
require 'etc'
require 'pathname'
require 'securerandom'
require 'shellwords'
require 'time'
# Object used for simplified communication SSH hosts
#
# @api private
class OodCore::Job::Adapters::LinuxHost::Launcher
attr_reader :contain, :debug, :site_timeout, :session_name_label, :singularity_bin,
:si... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/spec_helper.rb | Ruby | mit | 19 | master | 5,185 | require 'ood_core'
require 'climate_control'
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper`... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/clusters_spec.rb | Ruby | mit | 19 | master | 4,258 | require "spec_helper"
require "pathname"
def malformed_msg
"(<unknown>): mapping values are not allowed in this context at line 5 column 8"
end
describe OodCore::Clusters do
describe "#load_file" do
context "when loading a valid file" do
let(:config) { Pathname.pwd + 'spec/fixtures/config/clusters.d/oak... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/cluster_spec.rb | Ruby | mit | 19 | master | 5,833 | require "spec_helper"
describe OodCore::Cluster do
describe "#==" do
context "with two clusters that only specify ids" do
let(:owens) { OodCore::Cluster.new({ :id => "owens" }) }
let(:oakley) { OodCore::Cluster.new({ :id => "oakley" }) }
it "is not equal when comparing both clusters" do
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/acl/adapters/group_spec.rb | Ruby | mit | 19 | master | 2,571 | require 'spec_helper'
require 'ood_core/acl/adapters/group'
describe OodCore::Acl::Adapters::Group do
def build_group_acl(opts = {})
OodCore::Acl::Factory.build_group(opts)
end
describe "#new" do
context 'when nothing is provided' do
it 'raises an error' do
expect { subject }.to raise_err... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/status_spec.rb | Ruby | mit | 19 | master | 2,349 | require "spec_helper"
describe OodCore::Job::Status do
states =
%i(queued queued_held running suspended undetermined completed)
subject { described_class.new(state: :running) }
it { is_expected.to respond_to(:state) }
it { is_expected.to respond_to(:to_sym) }
it { is_expected.to respond_to(:to_s) }
s... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/node_info_spec.rb | Ruby | mit | 19 | master | 1,354 | require "spec_helper"
describe OodCore::Job::NodeInfo do
def build_ninfo(opts = {})
described_class.new(
**{
name: name,
procs: procs
}.merge(opts)
)
end
# Required arguments
let(:name) { "my_node" }
let(:procs) { 123 }
# Subject
subject { build_ninfo }
it { is_e... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/factory_spec.rb | Ruby | mit | 19 | master | 1,505 | require "spec_helper"
describe OodCore::Job::Factory do
describe ".build" do
context "when config not defined" do
it "raises ArgumentError" do
expect { described_class.build }.to raise_error(ArgumentError)
end
end
def build_config(opts = {})
{}.merge opts
end
let(:conf... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/live_system_spec.rb | Ruby | mit | 19 | master | 4,407 | require 'spec_helper'
def native_for_adapter(adapter)
case adapter.class.to_s
when OodCore::Job::Adapters::Lsf.class.to_s
['-R', 'select[type == any]']
else
nil
end
end
describe 'a live system', :if => ENV['LIVE_CLUSTER_CONFIG'], :order => :defined do
before(:all) do
# load job config either fro... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/array_ids_spec.rb | Ruby | mit | 19 | master | 2,336 | require "spec_helper"
require "ood_core/job/array_ids"
# Note that while all tests should pass not all passing inputs are valid for
# all Resource Managers
describe OodCore::Job::ArrayIds do
context "when the spec is for a range" do
it "returns the correct IDs" do
expect( described_class.new('1-4').ids ).... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapter_spec.rb | Ruby | mit | 19 | master | 7,116 | require "spec_helper"
describe OodCore::Job::Adapter do
# Subject
subject(:adapter) { described_class.new }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternotok, :afterany) }
it { is_expected.to respond_to(:info_all).with(0).arguments.and_keywords(:attrs) }
it ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/task_status_spec.rb | Ruby | mit | 19 | master | 898 | require "spec_helper"
describe OodCore::Job::Task do
def build_info(opts = {})
described_class.new(
**{
id: id,
status: status
}.merge(opts)
)
end
# Required arguments
let(:id) { "my_id" }
let(:status) { OodCore::Job::Status.new(state: :running) }
# Subject
subje... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/script_spec.rb | Ruby | mit | 19 | master | 7,487 | require "spec_helper"
describe OodCore::Job::Script do
def build_script(opts = {})
described_class.new(
**{
content: content
}.merge(opts)
)
end
# Required arguments
let(:content) { "my script content" }
# Subject
subject { build_script }
it { is_expected.to respond_to(:con... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/info_spec.rb | Ruby | mit | 19 | master | 6,044 | require "spec_helper"
describe OodCore::Job::Info do
def build_info(opts = {})
described_class.new(
**{
id: id,
status: status
}.merge(opts)
)
end
# Required arguments
let(:id) { "my_id" }
let(:status) { OodCore::Job::Status.new(state: :running) }
# Subject
subje... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/sge_spec.rb | Ruby | mit | 19 | master | 7,833 | require "spec_helper"
require "ood_core/job/adapters/sge"
describe OodCore::Job::Adapters::Sge do
# # Required arguments
let(:batch) { double() }
subject(:adapter) { described_class.new(batch: batch) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternotok, :aftera... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/slurm_spec.rb | Ruby | mit | 19 | master | 55,463 | require "spec_helper"
require "ood_core/job/adapters/slurm"
describe OodCore::Job::Adapters::Slurm do
# Required arguments
let(:slurm) { double() }
# Subject
subject(:adapter) { described_class.new(slurm: slurm) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afte... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/ccq_spec.rb | Ruby | mit | 19 | master | 9,558 | require "spec_helper"
require "ood_core/job/adapters/ccq"
# FakeFile a simple helper class to fake a file
class FakeFile
attr_reader :path
def initialize(path)
@path = path
end
def close; end
def flush; end
def write(content); end
end
describe OodCore::Job::Adapters::CCQ do
subject(:adapter) { d... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/psij_spec.rb | Ruby | mit | 19 | master | 29,697 | require "spec_helper"
require "ood_core/job/adapters/psij"
describe OodCore::Job::Adapters::PSIJ do
# Required arguments
let(:psij) { double() }
let(:qstat_factor) { nil }
# Subject
subject(:adapter) { described_class.new(psij: psij) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/helper_spec.rb | Ruby | mit | 19 | master | 2,721 | require "spec_helper"
require "ood_core/job/adapters/helper"
describe OodCore::Job::Adapters::Helper do
subject(:helper) { described_class }
it { is_expected.to respond_to(:bin_path).with(3).arguments }
describe "#bin_path" do
let(:cmd) { "sbatch" }
let(:bin) { Pathname.new("/opt/slurm/bin") }
con... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/linux_host_spec.rb | Ruby | mit | 19 | master | 12,969 | require "spec_helper"
require "ood_core/job/adapters/linux_host"
describe OodCore::Job::Adapters::LinuxHost do
let(:launcher) { double() }
let(:ssh_hosts) { [
'owens-login01.hpc.osc.edu',
'owens-login02.hpc.osc.edu',
'owens-login03.hpc.osc.edu'
] }
subject(:adapter) {
de... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/torque_spec.rb | Ruby | mit | 19 | master | 33,934 | require "spec_helper"
require "ood_core/job/adapters/torque"
describe OodCore::Job::Adapters::Torque do
# Required arguments
let(:pbs) { double() }
# Subject
subject(:adapter) { described_class.new(pbs: pbs) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternot... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/lsf_spec.rb | Ruby | mit | 19 | master | 10,496 | require "spec_helper"
require "ood_core/job/adapters/lsf"
describe OodCore::Job::Adapters::Lsf do
let(:batch) { double() }
subject(:adapter) { described_class.new(batch: batch) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternotok, :afterany) }
it { is_expected.... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/kubernetes_spec.rb | Ruby | mit | 19 | master | 1,235 | require "ood_core/job/adapters/kubernetes"
describe OodCore::Job::Adapters::Kubernetes do
let(:batch) { double() }
subject(:adapter) { described_class.new(batch) }
it { is_expected.to respond_to(:submit).with(1).argument.and_keywords(:after, :afterok, :afternotok, :afterany) }
it { is_expected.to respond_to(:... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/pbspro_spec.rb | Ruby | mit | 19 | master | 32,565 | require "spec_helper"
require "ood_core/job/adapters/pbspro"
describe OodCore::Job::Adapters::PBSPro do
# Required arguments
let(:pbspro) { double() }
let(:qstat_factor) { nil }
# Subject
subject(:adapter) { described_class.new(pbspro: pbspro, qstat_factor: qstat_factor) }
it { is_expected.to respond_to(... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/linux_host/launcher_spec.rb | Ruby | mit | 19 | master | 24,255 | require "spec_helper"
require "ood_core/job/adapters/linux_host"
require "ood_core/job/adapters/linux_host/launcher"
describe OodCore::Job::Adapters::LinuxHost::Launcher do
def build_script(opts = {})
OodCore::Job::Script.new(**{
accounting_id: nil,
args: nil,
content: ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/sge/batch_spec.rb | Ruby | mit | 19 | master | 14,012 | require "spec_helper"
require "ood_core/job/adapters/sge"
require "ood_core/job/adapters/sge/batch"
def load_resource_file(file_name)
File.open(file_name, 'r') { |f| f.read }
end
describe OodCore::Job::Adapters::Sge::Batch do
subject(:batch) {described_class.new({:cluster => '', :bin => ''})}
let(:jobs_from_qst... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/sge/helper_spec.rb | Ruby | mit | 19 | master | 1,202 | require "spec_helper"
require "ood_core/job/adapters/sge/helper"
describe OodCore::Job::Adapters::Sge::Helper do
subject(:helper) {described_class.new}
describe "#script_contains_wd_directive?" do
let(:match_w_no_space) {'#$-wd /home/ood/ondemand'}
let(:match_leading_space) {'#$ -wd /home/ood/ondemand'}
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/torque/batch_spec.rb | Ruby | mit | 19 | master | 7,306 | require "spec_helper"
require "ood_core/job/adapters/torque"
require "ood_core/job/adapters/torque/batch"
include OodCore::Job::Adapters
describe OodCore::Job::Adapters::Torque::Batch do
subject(:batch) { described_class.new(host: host, lib: lib, bin: bin) }
let(:host) { double(to_s: "HOST") }
let(:bin) { doub... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/kubernetes/batch_spec.rb | Ruby | mit | 19 | master | 41,968 | require "ood_core/job/adapters/kubernetes"
require "ood_core/job/adapters/kubernetes/batch"
require 'tmpdir'
describe OodCore::Job::Adapters::Kubernetes::Batch do
Batch = OodCore::Job::Adapters::Kubernetes::Batch
Helper = OodCore::Job::Adapters::Kubernetes::Helper
K8sJobInfo = OodCore::Job::Adapters::Kubernetes... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/kubernetes/helper_spec.rb | Ruby | mit | 19 | master | 20,794 | require "ood_core/job/adapters/kubernetes"
require "ood_core/job/adapters/kubernetes/helper"
require "ood_core/job/adapters/kubernetes/k8s_job_info"
require "json"
require "date"
using OodCore::Refinements::HashExtensions
describe OodCore::Job::Adapters::Kubernetes::Helper do
subject(:helper){
helper = describe... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/lsf/batch_spec.rb | Ruby | mit | 19 | master | 10,614 | require "ood_core/job/adapters/lsf"
require "ood_core/job/adapters/lsf/batch"
require "timecop"
describe OodCore::Job::Adapters::Lsf::Batch do
subject(:batch) { described_class.new() }
#TODO: consider using contexts http://betterspecs.org/#contexts
describe "#parse_bsub_output" do
# parse bsubmit output
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | spec/job/adapters/lsf/helper_spec.rb | Ruby | mit | 19 | master | 7,453 | require "ood_core/job/adapters/lsf"
require "ood_core/job/adapters/lsf/helper"
require "timecop"
describe OodCore::Job::Adapters::Lsf::Helper do
subject(:helper) { described_class.new() }
describe "#parse_past_time" do
it "converts time using current year" do
Timecop.freeze(Time.local(2017, 07, 01))
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | test/test_helper.rb | Ruby | mit | 19 | master | 1,285 | require 'ood_core'
require 'mocha/minitest'
module TestHelper
# verify the keywords of an objects interface.
# Example: given the interface - def foo(bar: nil)
# veryify_keywords(object, :foo, [:bar])
# to verify that the method foo takes only one keyword :bar.
def veryify_keywords(object, method, keywords)... |
github | OSC/ood_core | https://github.com/OSC/ood_core | test/job/adapters/slurm_test.rb | Ruby | mit | 19 | master | 3,473 | require 'test_helper'
class TestSlurm < Minitest::Test
include TestHelper
def slurm_instance(config = {})
OodCore::Job::Factory.build({ adapter: 'slurm', id: 'owens' }.merge(config))
end
def slurm_instance_fixture(cluster = 'glen')
dir = "spec/fixtures/config/clusters.d"
clusters = OodCore::Clust... |
github | OSC/ood_core | https://github.com/OSC/ood_core | test/job/adapters/linux_host_test.rb | Ruby | mit | 19 | master | 318 | require 'test_helper'
class LinuxHostTest < Minitest::Test
include TestHelper
def linux_host_instance(config = { singularity_image: '/dev/null' })
OodCore::Job::Factory.build({ adapter: 'linux_host' }.merge(config))
end
def test_instantiation
lha = linux_host_instance
refute_nil(lha)
end
end |
github | OSC/ood_core | https://github.com/OSC/ood_core | test/job/adapters/systemd_launcher_test.rb | Ruby | mit | 19 | master | 1,663 | require 'test_helper'
require 'ood_core/job/adapters/systemd'
require 'ood_core/job/adapters/systemd/launcher'
class SystemdLauncherTest < Minitest::Test
include TestHelper
def launcher_instance(config = {})
default = { ssh_hosts: ['foo'], submit_host: 'localhost' }
OodCore::Job::Adapters::LinuxSystemd::L... |
github | OSC/ood_core | https://github.com/OSC/ood_core | test/job/adapters/systemd_test.rb | Ruby | mit | 19 | master | 278 | require 'test_helper'
class SystemdTest < Minitest::Test
include TestHelper
def systemd_instance(config = { })
OodCore::Job::Factory.build({ adapter: 'systemd' }.merge(config))
end
def test_instantiation
sysd = systemd_instance
refute_nil(sysd)
end
end |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | Rakefile | Ruby | mit | 19 | master | 1,308 | require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "warden_strategies"
gem.summary = %Q{A collection of strategies for Warden}
gem.description = %Q{A collection of basic warden strategies}
gem.email = "has.sox@gmail.com"
gem.homepage = "http://githu... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | spec/spec_helper.rb | Ruby | mit | 19 | master | 362 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rack'
require 'warden_strategies'
require 'spec'
require 'spec/autorun'
Dir[File.join(File.dirname(__FILE__), "helpers", "**/*.rb")].each do |f|
require f
end
Spec::Runner.configure do |config|
c... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | spec/warden_strategies/base_spec.rb | Ruby | mit | 19 | master | 538 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
describe WardenStrategies::Base do
before do
@env = Rack::MockRequest.env_for("/")
class ::User; end
end
it "should allow me to get the User class by default" do
s = WardenStrategies::Base.new(@env, scope = :default)
... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | spec/warden_strategies/simple_spec.rb | Ruby | mit | 19 | master | 5,784 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
describe WardenStrategies::Simple do
before do
@env = Rack::MockRequest.env_for("/", :input => Rack::Utils.build_query(
:name => "Homer", "foo[bar]" => "baz"
))
class ::User; end
end
it "should setup the spec corr... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | spec/helpers/request_helper.rb | Ruby | mit | 19 | master | 362 | module WardenStrategies
module Spec
def env_with_params(path = "/", params = {})
method = params.fetch(:method, "GET")
Rack::MockRequest.env_for(path, :input => Rack::Utils.build_query(params),
'HTTP_VERSION' => '1.1',
'REQUEST_... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies.rb | Ruby | mit | 19 | master | 428 | require 'warden'
$:.push(File.expand_path(File.dirname(__FILE__)))
module WardenStrategies
autoload :Base, "warden_strategies/base"
autoload :Simple, "warden_strategies/simple"
autoload :Bcrypt, "warden_strategies/bcrypt"
module Mixins
module Bcrypt
autoload :Base, "warden_strateg... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/base.rb | Ruby | mit | 19 | master | 352 | module WardenStrategies
class Base < Warden::Strategies::Base
# Provides access to a user class.
# this should be overwritten in sub-classes to provde access
# to particular user classes
#
# @return A class to use as the "User" class for the request to use
# @api overwritable
def user_cla... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/bcrypt.rb | Ruby | mit | 19 | master | 812 | module WardenStrategies
# Create a migration for the following fields:
# _crypted_password - String
# _password_salt - String
#
# Then include WardenStrategies::Bcrypt::Mixins::ActiveRecord
#
# @example
# class MyClass < ActiveRecord::Base
# include WardenStrategies::Bcrypt::Mixins::ActiveRe... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/simple.rb | Ruby | mit | 19 | master | 4,771 | module WardenStrategies
# The Simple strategy is a strategy that will accept a simple list of requried parameters, a user class
# an authenticate_method and an error message and use those to authenticate a "user"
#
# The following example will create a strategy that will check an account for a user login
# w... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/authlogic.rb | Ruby | mit | 19 | master | 1,034 | Rails.configuration.middleware.use RailsWarden::Manager do |manager|
manager.default_strategies :bcrypt
manager.failure_app = SessionsController
end
# Setup Session Serialization
Warden::Manager.serialize_into_session{ |user| [user.class, user.id] }
Warden::Manager.serialize_from_session{ |klass, id| klass.find(id... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/bcrypt/base.rb | Ruby | mit | 19 | master | 935 | module WardenStrategies
class Bcrypt
module Mixins
module Base
def password=(pass)
@password = pass
unless pass.blank?
self._crypted_password = pass.nil? ? nil : ::BCrypt::Password.create("#{pass}#{password_salt}", :cost => 10)
end
@password
... |
github | hassox/warden_strategies | https://github.com/hassox/warden_strategies | lib/warden_strategies/bcrypt/active_record.rb | Ruby | mit | 19 | master | 832 | module WardenStrategies
class Bcrypt
module Mixins
module ActiveRecord
def self.included(base)
base.class_eval do
extend WardenStrategies::Bcrypt::Mixins::ActiveRecord::ClassMethods
include WardenStrategies::Bcrypt::Mixins::Base
attr_accessor :passwor... |
github | ymendel/flac2mp3 | https://github.com/ymendel/flac2mp3 | flac2mp3.gemspec | Ruby | mit | 19 | master | 713 | Gem::Specification.new do |gem|
gem.add_development_dependency 'bacon', '>= 1.1.0'
gem.add_development_dependency 'facon', '>= 0.5.0'
gem.add_runtime_dependency 'flacinfo-rb', '>= 0.4'
gem.add_runtime_dependency 'ruby-mp3info', '>= 0.5.1'
gem.authors = ['Yossef Mendelssohn']
gem.description = %q{A simple c... |
github | ymendel/flac2mp3 | https://github.com/ymendel/flac2mp3 | lib/flac2mp3.rb | Ruby | mit | 19 | master | 3,970 | $:.unshift File.dirname(__FILE__)
require 'flacinfo'
require 'mp3info'
require 'yaml'
class Flac2mp3
def initialize(options = {})
load_config
set_options(options)
end
def convert(filename)
raise TypeError, "'#{filename}' is not a file" unless FileTest.file?(filename)
process_conversion(filename)... |
github | ymendel/flac2mp3 | https://github.com/ymendel/flac2mp3 | spec/flac2mp3_spec.rb | Ruby | mit | 19 | master | 29,717 | require File.dirname(__FILE__) + '/spec_helper.rb'
describe Flac2mp3 do
before do
@flac2mp3 = Flac2mp3.new
end
describe 'when initialized' do
before do
@options = { :silent => true, :delete => false }
end
it 'should accept options' do
lambda { Flac2mp3.new(@options) }.should.not.rai... |
github | ymendel/flac2mp3 | https://github.com/ymendel/flac2mp3 | spec/metaflac2mp3_command_spec.rb | Ruby | mit | 19 | master | 1,129 | require File.dirname(__FILE__) + '/spec_helper.rb'
describe 'metaflac2mp3 command' do
def run_command(*args)
Object.const_set(:ARGV, args)
begin
eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin metaflac2mp3]))
rescue SystemExit
end
end
before do
Flac2mp3.stub!(:convert_metad... |
github | ymendel/flac2mp3 | https://github.com/ymendel/flac2mp3 | spec/flac2mp3_command_spec.rb | Ruby | mit | 19 | master | 4,367 | require File.dirname(__FILE__) + '/spec_helper.rb'
def run_command(*args)
Object.const_set(:ARGV, args)
begin
eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin flac2mp3]))
rescue SystemExit
end
end
describe 'flac2mp3 command' do
before do
Flac2mp3.stub!(:convert)
Flac2mp3.stub!(:conver... |
github | sinisterchipmunk/genspec | https://github.com/sinisterchipmunk/genspec | genspec.gemspec | Ruby | mit | 19 | master | 1,076 | # -*- encoding: utf-8 -*-
require File.expand_path("lib/genspec/version", File.dirname(__FILE__))
Gem::Specification.new do |s|
s.name = 'genspec'
s.version = GenSpec::VERSION
s.authors = ["Colin MacKenzie IV"]
s.description = %q{Simple, expressive Thor and/or Rails 3+ generator testing for RSpec. For the Ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.