Plugin and API reference¶
Registration¶
[project.entry-points."transpiler_mate.plugins"]
cwl2webgl = "cwl2webgl.plugin:cwl2webgl"
The plugin is registered with transpiler_mate.api.transpiler_plugin. Import it
and its options from cwl2webgl.plugin; the package root exports __version__.
Options¶
| Python field | CLI option | Type | Default | Meaning |
|---|---|---|---|---|
output |
--output |
pathlib.Path |
workflow.html |
Destination HTML file |
overwrite |
--overwrite |
bool |
False |
Allow replacement of an existing destination |
CWL2WebGLOptions rejects unknown fields. Workflow selection and the title are
provided by context.process_id and context.metadata.name, respectively.
Execute from a host¶
from pathlib import Path
from transpiler_mate.api import TranspilerContext
from cwl2webgl.plugin import CWL2WebGLOptions, cwl2webgl
def export_workflow(context: TranspilerContext) -> None:
cwl2webgl.execute(
context,
CWL2WebGLOptions(output=Path("workflow.html"), overwrite=True),
)
The host supplies these context fields:
| Field | Use |
|---|---|
source |
Base location for relative references and view identity |
document / processes |
Already-loaded cwl-utils process objects |
process_id |
Optional selected workflow ID; otherwise include all workflows |
metadata.name |
Viewer heading and browser title |
resolver |
Resolves external process references into another context |
Execution returns None and writes the destination. The plugin reads the DOM
without modifying it. CWL 1.0, 1.1, and 1.2 DOMs are covered by the tests.
Render without writing¶
render(context, options) returns the complete HTML as a string. It does not
write files or apply overwrite checks. The output and overwrite options are
used by plugin execution, not by rendering.
from cwl2webgl.plugin import CWL2WebGLOptions, render
# context is supplied by the host.
html = render(context, CWL2WebGLOptions())
Projection internals¶
Projection(context).build(workflow_id=None) returns presentation data with
version, roots, and views. A supplied workflow ID takes precedence over
context.process_id. Exact IDs are preferred; unique short IDs are accepted for
root selection. Process-reference resolution does not use basename matching.
Views contain workflow details, nodes, and edges. Nodes retain cwlId, kind,
label, and details; subworkflow nodes also reference a child view. Edges
retain source and target node IDs, exact port IDs, and binding details. This is
internal rendering data, not a separate CWL model or a stable interchange API.
Error behavior¶
PluginFailureError reports invalid selections, no workflows, ambiguous or
recursive references, duplicate nodes or source ports, unknown connection
sources, and protected output paths.
PluginExecutionError wraps resolver errors and unexpected generation or I/O
errors. The original exception is retained as its cause. Existing output is
only replaced after rendering and writing the temporary file succeed. Temporary
files are cleaned up on completion or failure.
Generated API documentation¶
Bases: BaseModel
Options accepted by the CWL to WebGL plugin.
Source code in src/cwl2webgl/plugin.py
40 41 42 43 44 45 46 | |
Source code in src/cwl2webgl/plugin.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
Per-invocation traversal state, containing references to the existing DOM.
Source code in src/cwl2webgl/projection.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
run(step, context)
¶
Resolve a step process and its owning context.
| Raises: |
|
|---|
Source code in src/cwl2webgl/projection.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
view(workflow, context)
¶
Build a workflow view, rejecting recursive workflow references.
Source code in src/cwl2webgl/projection.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |