Parser¶
Defines the data model for Choregraph pipeline specifications and provides XML parsing.
The dataclasses here (ChoregraphSpec, InputSpec, NodeSpec, InputPortSpec, OutputPortSpec)
form the in-memory representation of a pipeline graph. ChoregraphSpecParser reads XML into
these structures.
parser
¶
InputSpec
dataclass
¶
Defines an input data source.
InputPortSpec
dataclass
¶
Defines an input port consumed by a transform node.
OutputPortSpec
dataclass
¶
Defines an output port produced by a transform node.
NodeSpec
dataclass
¶
Defines a transform node in the pipeline.
ChoregraphSpec
dataclass
¶
In-memory representation of a complete Choregraph pipeline specification.
Holds inputs, transform nodes, and output declarations. Provides name
resolution from XML IDs to sanitized Kedro dataset names via :meth:get_name.
select_by_tag
¶
Returns a new ChoregraphSpec containing only objects corresponding to the tag. Supported tags: 'input' (for inputs), 'node' (for nodes).
Source code in src/choregraph/parser.py
get_attribute
¶
Returns a list of values for the specified attribute from all objects (inputs and nodes) in the spec.
Source code in src/choregraph/parser.py
get_name
¶
Returns the clean, readable Kedro name for a given XML ID. Rebuilds the map if the ID is not found. Works for both input IDs and output port IDs.
Source code in src/choregraph/parser.py
select_by_attribute
¶
Returns a new ChoregraphSpec containing objects (nodes or inputs) where the specified attribute matches the given value.
Source code in src/choregraph/parser.py
select_by_visibility
¶
Returns a new ChoregraphSpec containing objects (nodes or inputs) where the specified attribute matches the given value.
Source code in src/choregraph/parser.py
get_visible
¶
Returns all ports with visibility=True.
Source code in src/choregraph/parser.py
get_output_port_by_id
¶
Find an output port by its ID.
get_node_for_output_port
¶
Find the node that owns a given output port.
ChoregraphSpecParser
¶
Parses the Choregraph XML specification.
parse
staticmethod
¶
Parse an XML specification into a ChoregraphSpec.
| PARAMETER | DESCRIPTION |
|---|---|
xml_spec
|
Path to an XML file, or a raw XML string.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChoregraphSpec
|
Parsed ChoregraphSpec with inputs, nodes, and outputs populated. |
Source code in src/choregraph/parser.py
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 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |