wdl

package
v0.0.0-...-6baea6c Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateWorkflow

func GenerateWorkflow(wdlFile string, parameterFile string) wfv1.Workflow

func GetArgoWorkflow

func GetArgoWorkflow(document *Document) wfv1.Workflow

func GetInputsFromDocument

func GetInputsFromDocument(wdlWorkflow *Workflow) wfv1.Arguments

func GetInputsFromTask

func GetInputsFromTask(task Task) wfv1.Inputs

func GetOutputsFromTask

func GetOutputsFromTask(task Task) wfv1.Outputs

func GetParralelStepFromCalls

func GetParralelStepFromCalls(call string) wfv1.ParallelSteps

func GetTaskFromDocument

func GetTaskFromDocument(document *Document) map[string]wfv1.Template

func GetVersion

func GetVersion(uri string) (string, error)

GetVersion returns the version of the input WDL document.

func IsIn

func IsIn(str string, slice []string) bool

IsIn checks if str is inside the slice.

func NewWdlV1_0Parser

func NewWdlV1_0Parser(data string) *v1_0.WdlV1Parser

func ReadString

func ReadString(uri string) (string, error)

ReadString returns all the string content of the file pointed by the URI. Currently supported protocols are: relative and absolute paths, file://, and http(s)://.

func SmartOpen

func SmartOpen(uri string) (io.ReadCloser, error)

Types

type Any

type Any interface{}

type ArrayType

type ArrayType struct {
}

type BinaryOpExpr

type BinaryOpExpr struct {
	Type      string      `json:"type"`
	Left      IExpression `json:"left"`
	Operation string      `json:"op"`
	Right     IExpression `json:"right"`
}

BinaryOpExpr is a binary operation expression ( + and - ).

func NewBinaryOpExpr

func NewBinaryOpExpr(left IExpression, op string, right IExpression) BinaryOpExpr

func (BinaryOpExpr) GetType

func (this BinaryOpExpr) GetType() string

func (BinaryOpExpr) GetValue

func (this BinaryOpExpr) GetValue() interface{}

type Calls

type Calls struct {
	Name    Identifier                `json:"name"`
	As      Identifier                `json:"as,omitempty"`      // optional
	Aliases map[Identifier]Identifier `json:"aliases,omitempty"` // optional
	Inputs  []Declaration
}

type ComparisonExpr

type ComparisonExpr struct {
	Type      string      `json:"type"`
	Left      IExpression `json:"left"`
	Operation string      `json:"op"`
	Right     IExpression `json:"right"`
}

ComparisonExpr is a comparison expression.

func NewComparisonExpr

func NewComparisonExpr(left IExpression, op string, right IExpression) ComparisonExpr

func (ComparisonExpr) GetType

func (this ComparisonExpr) GetType() string

func (ComparisonExpr) GetValue

func (this ComparisonExpr) GetValue() interface{}

type CustomErrorListener

type CustomErrorListener struct {
	*antlr.DefaultErrorListener
	Errors []error
}

type Declaration

type Declaration struct {
	Type       Type         `json:"type"`
	Identifier Identifier   `json:"identifier"`
	Expr       *IExpression `json:"expr,omitempty"`
}

Declaration can be bounded (assigned to expression) or unbounded (no assignment).

type Document

type Document struct {
	// This is not part of WDL, but is useful to keep track of.
	Url string `json:"url"`

	Version  string    `json:"version"`
	Workflow *Workflow `json:"workflow,omitempty"` // optional
	Imports  []Import  `json:"imports,omitempty"`  // optional
	//Structs []Struct `json:"structs,omitempty"` // optional
	Tasks []Task `json:"tasks,omitempty"` // optional
}

func (Document) String

func (this Document) String() string

type FmtReporter

type FmtReporter struct{}

An IVisitorReporter that uses the fmt package to report messages.

func (*FmtReporter) Error

func (r *FmtReporter) Error(ctx antlr.ParserRuleContext, err error)

func (*FmtReporter) NotImplemented

func (r *FmtReporter) NotImplemented(message fmt.Stringer)

func (*FmtReporter) Warn

func (r *FmtReporter) Warn(ctx antlr.ParserRuleContext, warn string)

type IExpression

type IExpression interface {
	GetType() string
	GetValue() interface{}
}

type IVisitorReporter

type IVisitorReporter interface {
	Warn(antlr.ParserRuleContext, string)
	Error(antlr.ParserRuleContext, error)
	NotImplemented(fmt.Stringer)
}

type Identifier

type Identifier string

An identifier should match pattern /[a-zA-Z][a-zA-Z0-9_]+/ See: https://github.com/openwdl/wdl/blob/main/versions/1.0/SPEC.md#whitespace-strings-identifiers-constants

func (Identifier) IsValid

func (this Identifier) IsValid() bool

type Import

type Import struct {
	Url         string                    `json:"url"`
	AbsoluteUrl string                    `json:"absoluteUrl,omitempty"` // not part of WDL, but useful when resolving imports
	As          Identifier                `json:"as,omitempty"`          // optional
	Aliases     map[Identifier]Identifier `json:"aliases,omitempty"`     // optional
}

type InnerWorkflow

type InnerWorkflow struct {
	Name        Identifier    `json:"name"`
	Calls       []Identifier  `json:"calls,omitempty"`
	Scatter     []Declaration `json:"scatter,omitempty"`
	Conditional []Declaration `json:"conditional,omitempty"`
}

type InnerWorkflow2

type InnerWorkflow2 struct {
	Name           Identifier        `json:"name"`
	Inputs         []Declaration     `json:"inputs,omitempty"`
	Declarations   []Declaration     `json:"declarations,omitempty"`
	Calls          []Calls           `json:"calls,omitempty"`
	InnerWorkflows []InnerWorkflow   `json:"innerWorkflows,omitempty"`
	Scatter        []Declaration     `json:"scatter,omitempty"`
	Conditional    []Declaration     `json:"conditional,omitempty"`
	Output         []Declaration     `json:"outputs,omitempty"`
	Meta           map[string]string `json:"meta,omitempty"`
	ParameterMeta  map[string]string `json:"parameter_meta,omitempty"`
}

type LandExpr

type LandExpr struct {
	Type  string      `json:"type"`
	Left  IExpression `json:"left"`
	Right IExpression `json:"right"`
}

LandExpr is a logic AND expression.

func NewLandExpr

func NewLandExpr(left IExpression, right IExpression) LandExpr

func (LandExpr) GetType

func (this LandExpr) GetType() string

func (LandExpr) GetValue

func (this LandExpr) GetValue() interface{}

type LorExpr

type LorExpr struct {
	Type  string      `json:"type"`
	Left  IExpression `json:"left"`
	Right IExpression `json:"right"`
}

LorExpr is a logic OR expression.

func NewLorExpr

func NewLorExpr(left IExpression, right IExpression) LorExpr

func (LorExpr) GetType

func (this LorExpr) GetType() string

func (LorExpr) GetValue

func (this LorExpr) GetValue() interface{}

type Scatter

type Scatter struct {
	Name      Identifier                `json:"name"`
	As        Identifier                `json:"as,omitempty"`      // optional
	Aliases   map[Identifier]Identifier `json:"aliases,omitempty"` // optional
	Calls     []Calls                   `json:"calls,omitempty"`
	Intergers []Identifier              `json:"intergers,omitempty"`
}

type Struct

type Struct struct {
}

type Task

type Task struct {
	Name    Identifier                 `json:"name"`
	Input   []Declaration              `json:"inputs,omitempty"`
	Command string                     `json:"command"`
	Runtime map[Identifier]IExpression `json:"runtime"`
	Output  []Declaration              `json:"outputs,omitempty"`
}

type TerminalExpr

type TerminalExpr struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

func NewTerminalExpr

func NewTerminalExpr() TerminalExpr

func (TerminalExpr) GetType

func (this TerminalExpr) GetType() string

func (TerminalExpr) GetValue

func (this TerminalExpr) GetValue() interface{}

type Type

type Type struct {
	Optional bool `json:"optional,omitempty"`
}

type UnknownExpr

type UnknownExpr struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

func NewUnknownExpr

func NewUnknownExpr() UnknownExpr

func (UnknownExpr) GetType

func (this UnknownExpr) GetType() string

func (UnknownExpr) GetValue

func (this UnknownExpr) GetValue() interface{}

type WdlBuilder

type WdlBuilder struct {
	Url      string
	Version  string
	Document Document
}

func NewWdlBuilder

func NewWdlBuilder(url string) (*WdlBuilder, error)

func (*WdlBuilder) ParseDocument

func (this *WdlBuilder) ParseDocument() (*Document, error)

type WdlVisitor

type WdlVisitor struct {
	Url     string
	Version string
	*antlrv1_0.BaseWdlV1ParserVisitor
	Reporter IVisitorReporter
}

func NewWdlVisitor

func NewWdlVisitor(url string, version string) *WdlVisitor

func (*WdlVisitor) Visit

func (v *WdlVisitor) Visit(tree antlr.ParseTree) interface{}

Visit takes in any parse tree and visits the child nodes from there.

func (*WdlVisitor) VisitAny_decls

func (v *WdlVisitor) VisitAny_decls(ctx antlrv1_0.IAny_declsContext) Declaration

func (*WdlVisitor) VisitArray_type

func (v *WdlVisitor) VisitArray_type(ctx antlrv1_0.IArray_typeContext) interface{}

func (*WdlVisitor) VisitBound_decls

func (v *WdlVisitor) VisitBound_decls(ctx antlrv1_0.IBound_declsContext) Declaration

func (*WdlVisitor) VisitCall

func (v *WdlVisitor) VisitCall(ctx antlrv1_0.ICallContext) []Identifier

func (*WdlVisitor) VisitCall_alias

func (v *WdlVisitor) VisitCall_alias(ctx antlrv1_0.ICall_aliasContext) Identifier

func (*WdlVisitor) VisitCall_body

func (v *WdlVisitor) VisitCall_body(ctx antlrv1_0.ICall_bodyContext) Identifier

func (*WdlVisitor) VisitCall_input

func (v *WdlVisitor) VisitCall_input(ctx antlrv1_0.ICall_inputContext) Identifier

func (*WdlVisitor) VisitCall_inputs

func (v *WdlVisitor) VisitCall_inputs(ctx antlrv1_0.ICall_inputsContext) Identifier

func (*WdlVisitor) VisitCall_name

func (v *WdlVisitor) VisitCall_name(ctx antlrv1_0.ICall_nameContext) Identifier

func (*WdlVisitor) VisitChildren

func (v *WdlVisitor) VisitChildren(node antlr.RuleNode) interface{}

func (*WdlVisitor) VisitDocument

func (v *WdlVisitor) VisitDocument(ctx antlrv1_0.IDocumentContext) Document

func (*WdlVisitor) VisitDocument_element

func (v *WdlVisitor) VisitDocument_element(ctx antlrv1_0.IDocument_elementContext) interface{}

func (*WdlVisitor) VisitErrorNode

func (v *WdlVisitor) VisitErrorNode(node antlr.ErrorNode) interface{}

func (*WdlVisitor) VisitExpr

func (v *WdlVisitor) VisitExpr(ctx antlrv1_0.IExprContext) IExpression

func (*WdlVisitor) VisitExpr_infix5

func (v *WdlVisitor) VisitExpr_infix5(ctx antlrv1_0.IExpr_infix5Context) interface{}

func (*WdlVisitor) VisitExpression_placeholder_option

func (v *WdlVisitor) VisitExpression_placeholder_option(ctx antlrv1_0.IExpression_placeholder_optionContext) interface{}

func (*WdlVisitor) VisitImport_alias

func (v *WdlVisitor) VisitImport_alias(ctx antlrv1_0.IImport_aliasContext) (Identifier, Identifier)

VisitImport_alias returns the import alias as a mapping from the original identifer -> the aliased identifier. This is a terminal operation.

func (*WdlVisitor) VisitImport_as

func (v *WdlVisitor) VisitImport_as(ctx antlrv1_0.IImport_asContext) Identifier

VisitImport_as returns the identifier that refers to the import. This is a terminal operation.

func (*WdlVisitor) VisitImport_doc

func (v *WdlVisitor) VisitImport_doc(ctx antlrv1_0.IImport_docContext) Import

func (*WdlVisitor) VisitInfix0

func (*WdlVisitor) VisitInfix1

func (*WdlVisitor) VisitInfix2

func (*WdlVisitor) VisitInfix3

func (*WdlVisitor) VisitInfix4

func (*WdlVisitor) VisitInfix5

func (*WdlVisitor) VisitInner_workflow_element

func (v *WdlVisitor) VisitInner_workflow_element(ctx antlrv1_0.IInner_workflow_elementContext) InnerWorkflow

func (*WdlVisitor) VisitMap_type

func (v *WdlVisitor) VisitMap_type(ctx antlrv1_0.IMap_typeContext) interface{}

func (*WdlVisitor) VisitNumber

func (v *WdlVisitor) VisitNumber(ctx antlrv1_0.INumberContext) interface{}

func (*WdlVisitor) VisitPair_type

func (v *WdlVisitor) VisitPair_type(ctx antlrv1_0.IPair_typeContext) interface{}

func (*WdlVisitor) VisitPrimitive_literal

func (v *WdlVisitor) VisitPrimitive_literal(ctx antlrv1_0.IPrimitive_literalContext) interface{}

func (*WdlVisitor) VisitString

func (v *WdlVisitor) VisitString(ctx antlrv1_0.IStringContext) string

func (*WdlVisitor) VisitString_expr_part

func (v *WdlVisitor) VisitString_expr_part(ctx antlrv1_0.IString_expr_partContext) interface{}

func (*WdlVisitor) VisitString_expr_with_string_part

func (v *WdlVisitor) VisitString_expr_with_string_part(ctx antlrv1_0.IString_expr_with_string_partContext) interface{}

func (*WdlVisitor) VisitString_part

func (v *WdlVisitor) VisitString_part(ctx antlrv1_0.IString_partContext) string

func (*WdlVisitor) VisitTask

func (v *WdlVisitor) VisitTask(ctx antlrv1_0.ITaskContext) Task

func (*WdlVisitor) VisitTask_command

func (v *WdlVisitor) VisitTask_command(ctx antlrv1_0.ITask_commandContext) string

func (*WdlVisitor) VisitTask_command_expr_part

func (v *WdlVisitor) VisitTask_command_expr_part(ctx antlrv1_0.ITask_command_expr_partContext) string

func (*WdlVisitor) VisitTask_command_expr_with_string

func (v *WdlVisitor) VisitTask_command_expr_with_string(ctx antlrv1_0.ITask_command_expr_with_stringContext) string

func (*WdlVisitor) VisitTask_command_string_part

func (v *WdlVisitor) VisitTask_command_string_part(ctx antlrv1_0.ITask_command_string_partContext) string

func (*WdlVisitor) VisitTask_element

func (v *WdlVisitor) VisitTask_element(ctx antlrv1_0.ITask_elementContext) interface{}

func (*WdlVisitor) VisitTask_input

func (v *WdlVisitor) VisitTask_input(ctx antlrv1_0.ITask_inputContext) []Declaration

func (*WdlVisitor) VisitTask_output

func (v *WdlVisitor) VisitTask_output(ctx antlrv1_0.ITask_outputContext) []Declaration

func (*WdlVisitor) VisitTask_runtime

func (v *WdlVisitor) VisitTask_runtime(ctx antlrv1_0.ITask_runtimeContext) map[Identifier]IExpression

func (*WdlVisitor) VisitTask_runtime_kv

func (v *WdlVisitor) VisitTask_runtime_kv(ctx antlrv1_0.ITask_runtime_kvContext) map[Identifier]IExpression

func (*WdlVisitor) VisitTerminal

func (v *WdlVisitor) VisitTerminal(node antlr.TerminalNode) interface{}

func (*WdlVisitor) VisitType_base

func (v *WdlVisitor) VisitType_base(ctx antlrv1_0.IType_baseContext) interface{}

func (*WdlVisitor) VisitUnbound_decls

func (v *WdlVisitor) VisitUnbound_decls(ctx antlrv1_0.IUnbound_declsContext) Declaration

func (*WdlVisitor) VisitVersion

func (v *WdlVisitor) VisitVersion(ctx antlrv1_0.IVersionContext) string

VisitVersion returns the version as a string. This is a terminal operation.

func (*WdlVisitor) VisitWdl_type

func (v *WdlVisitor) VisitWdl_type(ctx antlrv1_0.IWdl_typeContext) Type

func (*WdlVisitor) VisitWorkflow

func (v *WdlVisitor) VisitWorkflow(ctx antlrv1_0.IWorkflowContext) Workflow

func (*WdlVisitor) VisitWorkflow_input

func (v *WdlVisitor) VisitWorkflow_input(ctx antlrv1_0.IWorkflow_inputContext) []Declaration

func (*WdlVisitor) VisitWorkflow_output

func (v *WdlVisitor) VisitWorkflow_output(ctx antlrv1_0.IWorkflow_outputContext) []Declaration

type Workflow

type Workflow struct {
	Name           Identifier        `json:"name"`
	Inputs         []Declaration     `json:"inputs,omitempty"`
	Declarations   []Declaration     `json:"declarations,omitempty"`
	Calls          []Calls           `json:"calls,omitempty"`
	InnerWorkflows []InnerWorkflow   `json:"innerWorkflows,omitempty"`
	Scatter        []Declaration     `json:"scatter,omitempty"`
	Conditional    []Declaration     `json:"conditional,omitempty"`
	Output         []Declaration     `json:"outputs,omitempty"`
	Meta           map[string]string `json:"meta,omitempty"`
	ParameterMeta  map[string]string `json:"parameter_meta,omitempty"`
}

Jump to

Keyboard shortcuts

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