run_test.cwl

 1#!/usr/bin/env cwl-runner
 2### Runs an SQL Test Script, presumably generated by DBT Utility
 3#  Copyright (c) 2021. Harvard University
 4#
 5#  Developed by Research Software Engineering,
 6#  Faculty of Arts and Sciences, Research Computing (FAS RC)
 7#  Author: Michael A Bouzinier
 8#
 9#  Licensed under the Apache License, Version 2.0 (the "License");
10#  you may not use this file except in compliance with the License.
11#  You may obtain a copy of the License at
12#
13#         http://www.apache.org/licenses/LICENSE-2.0
14#
15#  Unless required by applicable law or agreed to in writing, software
16#  distributed under the License is distributed on an "AS IS" BASIS,
17#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18#  See the License for the specific language governing permissions and
19#  limitations under the License.
20#
21
22cwlVersion: v1.2
23class: CommandLineTool
24baseCommand: [python, -m, dorieh.platform.dbt.dbt_runner]
25requirements:
26  InlineJavascriptRequirement: {}
27
28doc: |
29  Executes a test script from a given SQL file.
30  The test is presumed to have been generated by DBT Utility
31
32
33inputs:
34  database:
35    type: File
36    doc: Path to database connection file, usually database.ini
37    inputBinding:
38      prefix: --db
39  connection_name:
40    type: string
41    doc: The name of the section in the database.ini file
42    inputBinding:
43      prefix: --connection
44  script:
45    type:
46    - File
47    - File[]
48    inputBinding:
49      prefix: --script
50  depends_on:
51    type: Any?
52    doc: a special field used to enforce dependencies and execution order
53
54
55outputs:
56  log:
57    type: File
58    outputBinding:
59      glob: "*.log"
60  errors:
61    type: stderr
62
63stderr:  $("test-" + inputs.script.nameroot + ".err")