process

package
v0.0.0-...-c4d1d10 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 15 Imported by: 0

README

This library contains code for processing and executing CWL documents, such as CommandLineTools.

This code is experimental, young, and buggy, however it is able to bind inputs, generate command line arguments, and bind outputs. Currently the focus is on supporting CommandLineTool processing. Last checked (3/14/2018), about 15/68 conformance tests were passing.

Example

package main

import (
  "fmt"
  "github.com/buchanae/cwl"
  "github.com/buchanae/cwl/process"
  localfs "github.com/buchanae/cwl/process/fs/local"
)

func main() {
  // must be run from /examples dir
  path := "tar-param.cwl"
  inputsPath := "tar-param.inputs.yml"

  vals, err := cwl.LoadValuesFile(inputsPath)
  if err != nil {
    fmt.Println("error loading inputs:", err)
    return
  }

  doc, err := cwl.Load(path)
  if err != nil {
    panic(err)
  }

  tool, ok := doc.(*cwl.Tool)
  if !ok {
    panic("can only run command line tools")
  }

  rt := process.Runtime{}
  fs := localfs.NewLocal(".")

  proc, err := process.NewProcess(tool, vals, rt, fs)
  if err != nil {
    panic(err)
  }

  cmd, err := proc.Command()
  if err != nil {
    panic(err)
  }
  fmt.Println(cmd)
}

TODO / Questions

  • This may be a relative reference, in which case it must be resolved using the base IRI of the document. Does this mean relative to the inputs document?

Documentation

Index

Constants

View Source
const MaxContentsBytes = 64 * units.Kilobyte

Variables

View Source
var ErrFileNotFound = errors.New("file not found")

Functions

func DebugWorkflow

func DebugWorkflow(wf *cwl.Workflow, vals cwl.Values)

DebugWorkflow is a temporary placeholder for workflow processing code.

Types

type Binding

type Binding struct {

	// the bound type (resolved by matching the input value to one of many allowed types)
	// can be nil, which means no matching type could be determined.
	Type interface{}
	// the value from the input object
	Value cwl.Value
	// contains filtered or unexported fields
}

Binding binds an input type description (string, array, record, etc) to a concrete input value. this information is used while building command line args.

type Filesystem

type Filesystem interface {
	Create(path, contents string) (cwl.File, error)
	Info(loc string) (cwl.File, error)
	Contents(loc string) (string, error)
	Glob(pattern string) ([]cwl.File, error)
}

type Mebibyte

type Mebibyte int

type Process

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

func NewProcess

func NewProcess(tool *cwl.Tool, values cwl.Values, rt Runtime, fs Filesystem) (*Process, error)

func (*Process) Command

func (process *Process) Command() ([]string, error)

func (*Process) Env

func (process *Process) Env() map[string]string

func (*Process) InputBindings

func (process *Process) InputBindings() []*Binding

func (*Process) Outputs

func (process *Process) Outputs(fs Filesystem) (cwl.Values, error)

Outputs binds cwl.Tool output descriptors to concrete values.

func (*Process) Resources

func (process *Process) Resources() Resources

func (*Process) Stderr

func (process *Process) Stderr() string

func (*Process) Stdout

func (process *Process) Stdout() string

func (*Process) Tool

func (process *Process) Tool() *cwl.Tool

type Resources

type Resources struct {
	CoresMin,
	CoresMax int

	RAMMin,
	RAMMax,
	OutdirMin,
	OutdirMax,
	TmpdirMin,
	TmpdirMax Mebibyte
}

type Runtime

type Runtime struct {
	Outdir string
	Tmpdir string
	// TODO make these all strings?
	Cores      string
	RAM        Mebibyte
	OutdirSize Mebibyte
	TmpdirSize Mebibyte
}

TODO this is provided to expressions early on in process processing,

but it won't have real values from a scheduler until much later.

Directories

Path Synopsis
env
exec
fs

Jump to

Keyboard shortcuts

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