Skip to content
Snippets Groups Projects
Commit 2f414389 authored by sveseli's avatar sveseli
Browse files

api documentation updates

parent 616575be
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ class WorkflowProcApi(ProcRestApi): ...@@ -24,7 +24,7 @@ class WorkflowProcApi(ProcRestApi):
:param username: DM username (it may be omitted if environment variable DM_LOGIN_FILE points to a file containing the "<username>|<password>" pair) :param username: DM username (it may be omitted if environment variable DM_LOGIN_FILE points to a file containing the "<username>|<password>" pair)
:type username: str :type username: str
:param password: DM password (it may be omitted if environment variable DM_LOGIN_FILE points to a file containing the "<username>|<password>" pair) :param password: DM password (it may be omitted if environment variable DM_LOGIN_FILE points to a file containing the "<username>|<password>" pair)
:type password: str :type password: str
...@@ -41,7 +41,7 @@ class WorkflowProcApi(ProcRestApi): ...@@ -41,7 +41,7 @@ class WorkflowProcApi(ProcRestApi):
Add workflow to the DM workflow database. Workflows are defined Add workflow to the DM workflow database. Workflows are defined
using dictionaries, and they serve as templates for running using dictionaries, and they serve as templates for running
processing jobs. processing jobs.
Workflow keys: Workflow keys:
- name (required) - name (required)
- owner (required) - owner (required)
...@@ -52,7 +52,7 @@ class WorkflowProcApi(ProcRestApi): ...@@ -52,7 +52,7 @@ class WorkflowProcApi(ProcRestApi):
Stage dictionary keys can be anything; they will get sorted, Stage dictionary keys can be anything; they will get sorted,
and stages will get executed in the sorted order and stages will get executed in the sorted order
Stage keys: Stage keys:
- command (required; may use $variable strings that would get - command (required; may use $variable strings that would get
their values at runtime, via <key>:<value> arguments) their values at runtime, via <key>:<value> arguments)
...@@ -64,6 +64,7 @@ class WorkflowProcApi(ProcRestApi): ...@@ -64,6 +64,7 @@ class WorkflowProcApi(ProcRestApi):
subsequent workflow stages) subsequent workflow stages)
- repeatPeriod, repeatUntil, maxRepeats (optional; must be - repeatPeriod, repeatUntil, maxRepeats (optional; must be
used together): used together):
- repeatPeriod: - repeatPeriod:
- defines period in seconds after which the stage command - defines period in seconds after which the stage command
will be repeated will be repeated
...@@ -78,12 +79,11 @@ class WorkflowProcApi(ProcRestApi): ...@@ -78,12 +79,11 @@ class WorkflowProcApi(ProcRestApi):
- maxRepeats: - maxRepeats:
- defines maximum number of repeats; if this - defines maximum number of repeats; if this
number is reached, stage will fail number is reached, stage will fail
Reserved keys that cannot be used in a stage definition: Reserved keys that cannot be used in a stage definition:
- workflow: processing job workflow specification - workflow: processing job workflow specification
Reserved keys that may be used in a stage definition as command input Reserved keys that may be used in a stage definition as command input variables:
variables:
- id: processing job id - id: processing job id
- stage: processing job workflow stage - stage: processing job workflow stage
- status: processing job status - status: processing job status
...@@ -101,59 +101,53 @@ class WorkflowProcApi(ProcRestApi): ...@@ -101,59 +101,53 @@ class WorkflowProcApi(ProcRestApi):
- nFailedFiles: number of failed files - nFailedFiles: number of failed files
- nSkippedFiles: number of skipped files - nSkippedFiles: number of skipped files
- nAbortedFiles: number of aborted files - nAbortedFiles: number of aborted files
- nCompletedFiles: number of completed input files - nCompletedFiles: number of completed input files (sum of processed, failed, skipped and aborted files)
- sum of processed, failed, skipped and aborted files
- processedFiles: list of processed files - processedFiles: list of processed files
- failedFiles: list of failed files - failedFiles: list of failed files
- skippedFiles: list of skipped files - skippedFiles: list of skipped files
- abortedFiles: list of aborted files - abortedFiles: list of aborted files
Reserved keys designated for specifying processing job input Reserved keys designated for specifying processing job input files that may be used in a stage definition as command input variables:
files that may be used in a stage definition as command input - filePath: input file path (if filePath is specified as one of the stage command input variables, the workflow stage will iterate over all job input files)
variables:
- filePath: input file path
- if filePath is specified as one of the stage command
input variables, the workflow stage will iterate over
all job input files
- filePathList: list of all input file paths - filePathList: list of all input file paths
- filePathPattern: glob pattern for input file paths - filePathPattern: glob pattern for input file paths
- fileQueryDict: metadata catalog query dictionary - fileQueryDict: metadata catalog query dictionary (not yet implemented)
- not yet implemented (reserved for future use)
- dataDir: directory containing data files - dataDir: directory containing data files
Any keys that are not reserved may be used in a stage Any keys that are not reserved may be used in a stage
definition as command input or output variables. Stage output definition as command input or output variables. Stage output
variables can be used as input for any of the subsequent stages. variables can be used as input for any of the subsequent stages.
Example workflow definition: Example workflow definition:
{ {
'name' : 'example-01' 'name' : 'example-01',
'owner' : 'anOwner', 'owner' : 'anOwner',
'stages' : { 'stages' : {
'01-START' : { '01-START' : {
'command' : '/bin/date +%Y%m%d%H%M%S', 'command' : '/bin/date +%Y%m%d%H%M%S',
'outputVariableRegexList' : ['(?P<timeStamp>.*)'] 'outputVariableRegexList' : ['(?P<timeStamp>.*)']
}, },
'02-MKDIR' : { '02-MKDIR' : {
'command' : '/bin/mkdir -p /tmp/workflow.$timeStamp' 'command' : '/bin/mkdir -p /tmp/workflow.$timeStamp'
}, },
'03-ECHO' : { '03-ECHO' : {
'command' : '/bin/echo "START JOB ID: $id" > /tmp/workflow.$timeStamp/$id.out' 'command' : '/bin/echo "START JOB ID: $id" > /tmp/workflow.$timeStamp/$id.out'
}, },
'04-MD5SUM' : { '04-MD5SUM' : {
'command' : '/bin/md5sum $filePath | cut -f1 -d" "', 'command' : '/bin/md5sum $filePath | cut -f1 -d" "',
'outputVariableRegexList' : ['(?P<md5Sum>.*)'] 'outputVariableRegexList' : ['(?P<md5Sum>.*)']
}, },
'05-ECHO' : { '05-ECHO' : {
'command' : 'echo "FILE $filePath MD5 SUM: $md5Sum" >> /tmp/workflow.$timeStamp/$id.out' 'command' : 'echo "FILE $filePath MD5 SUM: $md5Sum" >> /tmp/workflow.$timeStamp/$id.out'
}, },
'06-DONE' : { '06-DONE' : {
'command' : '/bin/echo "STOP JOB ID: $id" >> /tmp/workflow.$timeStamp/$id.out' 'command' : '/bin/echo "STOP JOB ID: $id" >> /tmp/workflow.$timeStamp/$id.out'
}, },
}, },
'description' : 'Workflow Example 01' 'description' : 'Workflow Example 01'
} }
:param workflow: Workflow description :param workflow: Workflow description
:type workflow: Workflow or dict :type workflow: Workflow or dict
...@@ -430,15 +424,13 @@ class WorkflowProcApi(ProcRestApi): ...@@ -430,15 +424,13 @@ class WorkflowProcApi(ProcRestApi):
- nFailedFiles: number of failed files - nFailedFiles: number of failed files
- nSkippedFiles: number of skipped files - nSkippedFiles: number of skipped files
- nAbortedFiles: number of aborted files - nAbortedFiles: number of aborted files
- nCompletedFiles: number of completed input files - nCompletedFiles: number of completed input files (sum of processed, failed, skipped and aborted files)
- sum of processed, failed, skipped and aborted files
- processedFiles: list of processed files - processedFiles: list of processed files
- failedFiles: list of failed files - failedFiles: list of failed files
- skippedFiles: list of skipped files - skippedFiles: list of skipped files
- abortedFiles: list of aborted files - abortedFiles: list of aborted files
Reserved keys designated for specifying processing job input Reserved keys designated for specifying processing job input files that may be passed as job input at runtime:
files that may be passed as job input at runtime:
- filePath: input file path - filePath: input file path
- if filePath:<aPath> is specified as part of job input, the - if filePath:<aPath> is specified as part of job input, the
job input file list will consist of a single file job input file list will consist of a single file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment