drmaa2os

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2018 License: Apache-2.0 Imports: 14 Imported by: 21

README

drmaa2os - A Go API for OS Processes, Docker Containers, Cloud Foundry Tasks, Kubernetes Jobs, Grid Engine and more...

CircleCI

This is a Go API based on an open standard (Open Grid Forum DRMAA2) in order to submit and supervise workloads like OS processes, containers, PODs, tasks from a common interface.

It allows to develop and run job workflows in OS processes, and later easily switch to containers running as Cloud Foundry tasks, Docker containers, Grid Engine jobs, etc...

Its main pupose is supporting application developers with an abstraction layer on top of platforms, workload managers, and cluster schedulers, so that they don't require to deal with the underlaying details and differences when only simple operations (like starting a container and waiting until it is finished) are required.

It can be easily integrated in applications which create and execute job workflows.

If you are looking for a simple interface for creating job workflows without dealing with the DRMAA2 details, check out wfl.

For details about the mapping of job operations please consult the platform specific READMEs:

Feedback welcome!

For a DRMAA2 implementation based on C DRMAA2 (libdrmaa2.so) like for Univa Grid Engine please see drmaa2.

Not yet implemented:

Basic Usage

Following example demonstrates how a job running as OS process can be executed. More examples can be found in the examples subdirectory.

	sm, _ := drmaa2os.NewDefaultSessionManager("testdb.db")

	js, _ := sm.CreateJobSession("jobsession", "")

	jt := drmaa2interface.JobTemplate{
		JobName:       "job1",
		RemoteCommand: "sleep",
		Args:          []string{"2"},
	}

	job, _ := js.RunJob(jt)

	job.WaitTerminated(drmaa2interface.InfiniteTime)

	if job.GetState() == drmaa2interface.Done {
		job2, _ := js.RunJob(jt)
		job2.WaitTerminated(drmaa2interface.InfiniteTime)
	} else {
		fmt.Println("Failed to execute job1 successfully")
	}

	js.Close()
	sm.DestroyJobSession("jobsession")

Documentation

Overview

Package drmaa2os provides a DRMAA2 implementation based on the OS interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUnsupportedOperation = DRMAA2Error{"This optional function is not suppported."}
	ErrorJobNotExists         = DRMAA2Error{"The job does not exist."}
	ErrorInvalidState         = DRMAA2Error{"Invalid state."}
	ErrorInternal             = DRMAA2Error{"Internal error occurred."}
)

Functions

func CloseMonitoringSession

func CloseMonitoringSession() error

func GetAllMachines

func GetAllMachines(names []string) ([]drmaa2interface.Machine, error)

func GetAllQueues

func GetAllQueues(names []string) ([]drmaa2interface.Queue, error)

Types

type ArrayJob

type ArrayJob struct {
	// contains filtered or unexported fields
}

func NewArrayJob

func NewArrayJob(id, jsessionname string, tmpl drmaa2interface.JobTemplate, jobs []drmaa2interface.Job) *ArrayJob

func (*ArrayJob) GetID

func (aj *ArrayJob) GetID() string

func (*ArrayJob) GetJobTemplate

func (aj *ArrayJob) GetJobTemplate() drmaa2interface.JobTemplate

func (*ArrayJob) GetJobs

func (aj *ArrayJob) GetJobs() []drmaa2interface.Job

func (*ArrayJob) GetSessionName

func (aj *ArrayJob) GetSessionName() string

func (*ArrayJob) Hold

func (aj *ArrayJob) Hold() error

func (*ArrayJob) Release

func (aj *ArrayJob) Release() error

func (*ArrayJob) Resume

func (aj *ArrayJob) Resume() error

func (*ArrayJob) Suspend

func (aj *ArrayJob) Suspend() error

func (*ArrayJob) Terminate

func (aj *ArrayJob) Terminate() error

type Config

type Config struct {
}

func (*Config) Listen

func (c *Config) Listen() error

Listen starts the DRMAA2 OS interface service.

func (*Config) NewSessionManager

func (c *Config) NewSessionManager() (drmaa2interface.SessionManager, error)

func (*Config) Stop

func (c *Config) Stop() error

Stop stops the DRMAA2 OS interface service.

type DRMAA2Error

type DRMAA2Error struct {
	// contains filtered or unexported fields
}

func (DRMAA2Error) Error

func (d DRMAA2Error) Error() string

type Job

type Job struct {
	// contains filtered or unexported fields
}

func GetAllJobs

func GetAllJobs(filter drmaa2interface.JobInfo) ([]Job, error)

func NewJob

func NewJob(id, session string, jt drmaa2interface.JobTemplate, tracker jobtracker.JobTracker) *Job

func (*Job) GetID

func (j *Job) GetID() string

func (*Job) GetJobInfo

func (j *Job) GetJobInfo() (drmaa2interface.JobInfo, error)

func (*Job) GetJobTemplate

func (j *Job) GetJobTemplate() (drmaa2interface.JobTemplate, error)

func (*Job) GetSessionName

func (j *Job) GetSessionName() string

func (*Job) GetState

func (j *Job) GetState() drmaa2interface.JobState

func (*Job) Hold

func (j *Job) Hold() error

func (*Job) Reap

func (j *Job) Reap() error

func (*Job) Release

func (j *Job) Release() error

func (*Job) Resume

func (j *Job) Resume() error

func (*Job) Suspend

func (j *Job) Suspend() error

func (*Job) Terminate

func (j *Job) Terminate() error

func (*Job) WaitStarted

func (j *Job) WaitStarted(timeout time.Duration) error

func (*Job) WaitTerminated

func (j *Job) WaitTerminated(timeout time.Duration) error

type JobSession

type JobSession struct {
	// contains filtered or unexported fields
}

func NewJobSession

func NewJobSession(name string, tracker []jobtracker.JobTracker) *JobSession

func (*JobSession) Close

func (js *JobSession) Close() error

func (*JobSession) GetContact

func (js *JobSession) GetContact() (string, error)

func (*JobSession) GetJobArray

func (js *JobSession) GetJobArray(id string) (drmaa2interface.ArrayJob, error)

func (*JobSession) GetJobCategories

func (js *JobSession) GetJobCategories() ([]string, error)

func (*JobSession) GetJobs

func (js *JobSession) GetJobs(filter drmaa2interface.JobInfo) ([]drmaa2interface.Job, error)

func (*JobSession) GetSessionName

func (js *JobSession) GetSessionName() (string, error)

func (*JobSession) RunBulkJobs

func (js *JobSession) RunBulkJobs(jt drmaa2interface.JobTemplate, begin int, end int, step int, maxParallel int) (drmaa2interface.ArrayJob, error)

func (*JobSession) RunJob

func (*JobSession) WaitAnyStarted

func (js *JobSession) WaitAnyStarted(jobs []drmaa2interface.Job, timeout time.Duration) (drmaa2interface.Job, error)

func (*JobSession) WaitAnyTerminated

func (js *JobSession) WaitAnyTerminated(jobs []drmaa2interface.Job, timeout time.Duration) (drmaa2interface.Job, error)

type MonitoringSession

type MonitoringSession struct {
}

type Reservation

type Reservation struct {
}

func GetAllReservations

func GetAllReservations() ([]Reservation, error)

func (*Reservation) GetID

func (r *Reservation) GetID() (string, error)

func (*Reservation) GetInfo

func (*Reservation) GetSessionName

func (r *Reservation) GetSessionName() (string, error)

func (*Reservation) GetTemplate

func (*Reservation) Terminate

func (r *Reservation) Terminate() error

type ReservationSession

type ReservationSession struct {
}

func (*ReservationSession) Close

func (rs *ReservationSession) Close() error

func (*ReservationSession) GetContact

func (rs *ReservationSession) GetContact() (string, error)

func (*ReservationSession) GetReservation

func (*ReservationSession) GetReservations

func (rs *ReservationSession) GetReservations() ([]Reservation, error)

func (*ReservationSession) GetSessionName

func (rs *ReservationSession) GetSessionName() (string, error)

func (*ReservationSession) RequestReservation

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

func NewCloudFoundrySessionManager

func NewCloudFoundrySessionManager(addr, username, password, dbpath string) (*SessionManager, error)

func NewDefaultSessionManager

func NewDefaultSessionManager(dbpath string) (*SessionManager, error)

func NewDockerSessionManager

func NewDockerSessionManager(dbpath string) (*SessionManager, error)

func NewKubernetesSessionManager

func NewKubernetesSessionManager(dbpath string) (*SessionManager, error)

func (*SessionManager) CreateJobSession

func (sm *SessionManager) CreateJobSession(name, contact string) (drmaa2interface.JobSession, error)

func (*SessionManager) CreateReservationSession

func (sm *SessionManager) CreateReservationSession(name, contact string) (drmaa2interface.ReservationSession, error)

func (*SessionManager) DestroyJobSession

func (sm *SessionManager) DestroyJobSession(name string) error

func (*SessionManager) DestroyReservationSession

func (sm *SessionManager) DestroyReservationSession(name string) error

func (*SessionManager) GetDrmsName

func (sm *SessionManager) GetDrmsName() (string, error)

func (*SessionManager) GetDrmsVersion

func (sm *SessionManager) GetDrmsVersion() (drmaa2interface.Version, error)

func (*SessionManager) GetJobSessionNames

func (sm *SessionManager) GetJobSessionNames() ([]string, error)

func (*SessionManager) GetReservationSessionNames

func (sm *SessionManager) GetReservationSessionNames() ([]string, error)

func (*SessionManager) OpenJobSession

func (sm *SessionManager) OpenJobSession(name string) (drmaa2interface.JobSession, error)

func (*SessionManager) OpenMonitoringSession

func (sm *SessionManager) OpenMonitoringSession(sessionName string) (drmaa2interface.MonitoringSession, error)

func (*SessionManager) OpenReservationSession

func (sm *SessionManager) OpenReservationSession(name string) (drmaa2interface.ReservationSession, error)

func (*SessionManager) RegisterEventNotification

func (sm *SessionManager) RegisterEventNotification() (drmaa2interface.EventChannel, error)

func (*SessionManager) Supports

func (sm *SessionManager) Supports(capability drmaa2interface.Capability) bool

type SessionType

type SessionType int
const (
	DefaultSession      SessionType = iota // processes
	DockerSession                          // containers
	CloudFoundrySession                    // application tasks
	KubernetesSession                      // pods
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL