Skip to content

Pipeline

Bases: Plan

DataPipeline class to represent a data pipeline in the system, compromising of nodes (input, operators, output) and edges, representing the data flow between nodes.

Source code in blue/data/pipeline.py
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
class DataPipeline(dag_utils.Plan):
    """
    DataPipeline class to represent a data pipeline in the system, compromising of nodes (input, operators, output) and edges, representing the data flow between nodes.
    """

    def __init__(
        self,
        id=None,
        label=None,
        type="DATA_PIPELINE",
        properties=None,
        attributes=None,
        path=None,
        plan_provenance=None,
        plan_input=None,
        plan_output=None,
        synchronizer=None,
        auto_sync=False,
        sync=None,
    ):
        super().__init__(id=id, label=label, type=type, properties=properties, path=path, synchronizer=synchronizer, auto_sync=auto_sync, sync=sync)
        """ Initialize a DataPipeline object.

        Parameters:
            id (str): Unique identifier for the data pipeline. If None, a UUID will be generated.
            label (str): Label for the data pipeline.
            type (str): Type of the data pipeline. Default is "DATA_PIPELINE".
            properties (dict): Properties for the data pipeline.
            attributes (dict): Attributes for the data pipeline.
            path (str): Path in reference to synchronize the data pipeline.
            plan_provenance (str): Provenance string for the data pipeline.
            plan_input (str or Node): Input node or node ID for the data pipeline.
            plan_output (str or Node): Output node or node ID for the data pipeline.
            synchronizer: Synchronizer object to handle synchronization with the database.
            auto_sync (bool): Whether to automatically synchronize changes with the database.
            sync: Synchronization flag.
        """
        # plan_provenance
        if plan_provenance is None:
            plan_provenance = "$"
        self.set_plan_provenance(plan_provenance, sync=sync)

        # set plan input / output
        self.set_plan_input(plan_input, sync=sync)
        self.set_plan_output(plan_output, sync=sync)

        self._initialize_attributes(sync=sync)
        self._update_attributes(attributes=attributes, sync=sync)

    ### attributes
    def _initialize_attributes(self, sync=None):
        """
        Initialize attributes dictionary if not already present.

        Parameters:
            sync: Synchronization flag.
        """
        self.set_data("attributes", {}, sync=sync)

    def _update_attributes(self, attributes=None, sync=None):
        """
        Update attributes dictionary with new values.

        Parameters:
            attributes: Dictionary of attributes to update.
            sync: Synchronization flag.
        """
        if attributes is None:
            return

        # override
        for a in attributes:
            self.set_attribute(a, attributes[a], sync=sync)

    def set_attribute(self, key, value, sync=None):
        """
        Set an attribute for the data pipeline.

        Parameters:
            key (str): Attribute key.
            value: Attribute value.
            sync: Synchronization flag.
        """
        attributes = self.get_attributes()
        attributes[key] = value

        self.synchronize(key="attributes." + key, value=value)

    def get_attribute(self, key):
        """
        Get an attribute for the data pipeline.

        Parameters:
            key (str): Attribute key.

        Returns:
            value: Attribute value or None if not found.
        """
        attributes = self.get_attributes()
        if key in attributes:
            return attributes[key]
        return None

    def get_attributes(self):
        """
        Get all attributes for the data pipeline.

        Returns:
            (dict): Dictionary of attribute key-value pairs.
        """
        return self.get_data("attributes")

    # provenance
    def set_plan_provenance(self, plan_provenance, sync=None):
        """
        Set the plan provenance for the data pipeline.

        Parameters:
            plan_provenance (str): Plan provenance string.
            sync: Synchronization flag.
        """
        self.set_data("provenance", plan_provenance, sync=sync)

    def get_plan_provenance(self):
        """
        Get the plan provenance for the data pipeline.

        Returns:
            str: Plan provenance string.
        """
        return self.get_data("provenance")

    # plan input / output
    def set_plan_input_id(self, input_id, sync=None):
        """
        Set the plan input node ID for the data pipeline.

        Parameters:
            input_id: Input node ID.
            sync: Synchronization flag.
        """
        self.set_plan_input(input_id, sync=sync)

    def set_plan_input(self, i, sync=None):
        """
        Set the plan input for the data pipeline.

        Parameters:
            i: Input node object, id, or label.
            sync: Synchronization flag.
        """
        input_id = i

        input_node = self.get_node(i)
        # internal node, get node id
        if input_node:
            input_id = input_node.get_id()

        self.set_data("input", input_id, sync=sync)

    def get_plan_input_id(self, pipeline=None):
        """
        Get the plan input ID for the data pipeline.

        Parameters:
            pipeline: Pipeline entity or ID.

        Returns:
            Plan input ID.
        """
        if pipeline is None:
            return self.get_data("input")
        else:
            pipeline_entity = self.get_entity(pipeline)
            return pipeline_entity.get_data("input")

    def get_plan_input(self, pipeline=None):
        """
        Get the plan input node for the data pipeline.

        Parameters:
            pipeline: Pipeline entity or ID.

        Returns:
            Plan input node.
        """
        plan_input_id = self.get_plan_input_id(pipeline=pipeline)
        return self.get_node(plan_input_id)

    def set_plan_output_id(self, output_id, sync=None):
        """
        Set the plan output node ID for the data pipeline.

        Parameters:
            output_id: Output node ID.
            sync: Synchronization flag.
        """
        self.set_plan_output(output_id, sync=sync)

    def set_plan_output(self, o, sync=None):
        """
        Set the plan outputfor the data pipeline.

        Parameters:
            o: Output node object, id, or label.
            sync: Synchronization flag.
        """
        output_id = o

        output_node = self.get_node(o)
        # internal node, get node id
        if output_node:
            output_id = output_node.get_id()

        self.set_data("output", output_id, sync=sync)

    def get_plan_output_id(self, pipeline=None):
        """
        Get the plan output ID for the data pipeline.

        Parameters:
            pipeline: Pipeline entity or ID.

        Returns:
            Plan output ID.
        """
        if pipeline is None:
            return self.get_data("output")
        else:
            pipeline_entity = self.get_entity(pipeline)
            return pipeline_entity.get_data("output")

    def get_plan_output(self, pipeline=None):
        """
        Get the plan output node for the data pipeline.

        Parameters:
            pipeline: Pipeline entity or ID.

        Returns:
            Plan output node.
        """
        plan_output_id = self.get_plan_output_id(pipeline=pipeline)
        return self.get_node(plan_output_id)

    ## nodes
    def set_node_value(self, n, value=None, provenance=None, sync=None):
        """
        Set the node value for a node in the data pipeline.

        Parameters:
            n: Node object, id, or label.
            value: Value to set.
            provenance: Provenance information.
            sync: Synchronization flag.
        """
        node = self.get_node(n)
        node.set_data("value", value, sync=sync)

        if provenance:
            values = node.get_data("values")
            values[provenance] = value

            node.synchronize(key="values." + provenance, value=value, sync=sync)

    def get_node_value(self, n, provenance=None):
        """
        Get the node values for a node in the data pipeline, optionally filtered by provenance.

        Parameters:
            n: Node object, id, or label.
            provenance: Provenance information.

        Returns:
            Node value.
        """
        node = self.get_node(n)
        if provenance:
            values = node.get_data("values")
            if provenance in values:
                return values[provenance]
            else:
                return None
        else:
            return node.get_data("value")

    def get_node_values(self, n):
        """
        Get all node values for a node in the data pipeline.

        Parameters:
            n: Node object, id, or label.

        Returns:
            dict: Dictionary of provenance-value pairs.
        """
        node = self.get_node(n)
        return node.get_data("values")

    def set_node_status(self, n, status=None, provenance=None, sync=None):
        """
        Set the node status for a node in the data pipeline, optionally for specific provenance.

        Parameters:
            n: Node object, id, or label.
            status: Status to set.
            provenance: Provenance information.
            sync: Synchronization flag.
        """
        node = self.get_node(n)
        node.set_data("status", status, sync=sync)

        if provenance:
            statuses = node.get_data("statuses")
            statuses[provenance] = status

            node.synchronize(key="statuses." + provenance, value=status, sync=sync)

    def get_node_status(self, n, provenance=None):
        """
        Get the node status for a node in the data pipeline, optionally filtered by provenance.

        Parameters:
            n: Node object, id, or label.
            provenance: Provenance information.

        Returns:
            Node status.
        """
        node = self.get_node(n)
        if provenance:
            statuses = node.get_data("statuses")
            if provenance in statuses:
                return statuses[provenance]
            else:
                return None
        else:
            return node.get_data("status")

    def get_node_statuses(self, n):
        """
        Get all node statuses for a node in the data pipeline.

        Parameters:
            n: Node object, id, or label.

        Returns:
            dict: Dictionary of provenance-status pairs.
        """
        node = self.get_node(n)
        return node.get_data("statuses")

    def set_node_provenance(self, n):
        """
        Set the node provenance for a node in the data pipeline.

        Parameters:
            n: Node object, id, or label.
        """
        node = self.get_node(n)

        plan_provenance = self.get_plan_provenance()
        node.set_data("provenance", plan_provenance + "." + self.get_id())

    def define_input(self, label=None, value=None, provenance=None, properties={}, sync=None):
        """
        Define an input node in the data pipeline.

        Parameters:
            label: Node label.
            value: Input value.
            provenance: Provenance information.
            properties: Node properties.
            sync: Synchronization flag.
        """
        input_node = self.create_node(label=label, type=str(NodeType.INPUT), properties=properties, sync=sync)

        # values / provenance
        input_node.set_data('values', {}, sync=sync)
        input_node.set_data('statuses', {}, sync=sync)

        # input value/stream
        self.set_node_value(input_node, value=value, provenance=provenance, sync=sync)

        # set provenance
        self.set_node_provenance(input_node)

        return input_node

    def define_output(self, label=None, value=None, provenance=None, properties={}, sync=None):
        """
        Define an output node in the data pipeline.

        Parameters:
            label: Node label.
            value: Output value.
            provenance: Provenance information.
            properties: Node properties.
            sync: Synchronization flag.
        """
        output_node = self.create_node(label=label, type=str(NodeType.OUTPUT), properties=properties, sync=sync)

        # values / provenance
        output_node.set_data('values', {}, sync=sync)
        output_node.set_data('statuses', {}, sync=sync)

        # output value/stream
        self.set_node_value(output_node, value=value, provenance=provenance, sync=sync)

        # set provenance
        self.set_node_provenance(output_node)

        return output_node

    def define_operator(self, name, label=None, attributes={}, properties={}, sync=None):
        """
        Define an operator node in the data pipeline.

        Parameters:
            name: Operator name.
            label: Node label.
            attributes: Node attributes.
            properties: Node properties.
            sync: Synchronization flag.
        """
        # checks
        if name is None:
            raise Exception("Name is not specified")

        operator_node = self.create_node(label=label, type=str(NodeType.OPERATOR), properties=properties, sync=sync)

        # values / provenance
        operator_node.set_data('values', {}, sync=sync)
        operator_node.set_data('statuses', {}, sync=sync)

        operator = self.create_operator(name, attributes=attributes, properties=properties, sync=sync)

        self.set_node_entity(operator_node, operator, sync=sync)

        # set provenance
        self.set_node_provenance(operator_node)

        return operator_node

    ### operator
    def create_operator(self, name, label=None, attributes={}, properties={}, sync=None):
        """
        Create an operator entity.

        Parameters:
            name: Operator name (full path, e.g. /server/<server>/operator/<operator>).
            label: Operator label.
            attributes: Operator attributes.
            properties: Operator properties.
            sync: Synchronization flag.
        """
        operator = self.create_entity(label=label, type=str(EntityType.OPERATOR), properties=properties, sync=sync)
        operator.set_data("name", name)
        operator.set_data("attributes", attributes)

        return operator

create_operator(name, label=None, attributes={}, properties={}, sync=None)

Create an operator entity.

Parameters:

Name Type Description Default
name

Operator name (full path, e.g. /server//operator/).

required
label

Operator label.

None
attributes

Operator attributes.

{}
properties

Operator properties.

{}
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
def create_operator(self, name, label=None, attributes={}, properties={}, sync=None):
    """
    Create an operator entity.

    Parameters:
        name: Operator name (full path, e.g. /server/<server>/operator/<operator>).
        label: Operator label.
        attributes: Operator attributes.
        properties: Operator properties.
        sync: Synchronization flag.
    """
    operator = self.create_entity(label=label, type=str(EntityType.OPERATOR), properties=properties, sync=sync)
    operator.set_data("name", name)
    operator.set_data("attributes", attributes)

    return operator

define_input(label=None, value=None, provenance=None, properties={}, sync=None)

Define an input node in the data pipeline.

Parameters:

Name Type Description Default
label

Node label.

None
value

Input value.

None
provenance

Provenance information.

None
properties

Node properties.

{}
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
def define_input(self, label=None, value=None, provenance=None, properties={}, sync=None):
    """
    Define an input node in the data pipeline.

    Parameters:
        label: Node label.
        value: Input value.
        provenance: Provenance information.
        properties: Node properties.
        sync: Synchronization flag.
    """
    input_node = self.create_node(label=label, type=str(NodeType.INPUT), properties=properties, sync=sync)

    # values / provenance
    input_node.set_data('values', {}, sync=sync)
    input_node.set_data('statuses', {}, sync=sync)

    # input value/stream
    self.set_node_value(input_node, value=value, provenance=provenance, sync=sync)

    # set provenance
    self.set_node_provenance(input_node)

    return input_node

define_operator(name, label=None, attributes={}, properties={}, sync=None)

Define an operator node in the data pipeline.

Parameters:

Name Type Description Default
name

Operator name.

required
label

Node label.

None
attributes

Node attributes.

{}
properties

Node properties.

{}
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def define_operator(self, name, label=None, attributes={}, properties={}, sync=None):
    """
    Define an operator node in the data pipeline.

    Parameters:
        name: Operator name.
        label: Node label.
        attributes: Node attributes.
        properties: Node properties.
        sync: Synchronization flag.
    """
    # checks
    if name is None:
        raise Exception("Name is not specified")

    operator_node = self.create_node(label=label, type=str(NodeType.OPERATOR), properties=properties, sync=sync)

    # values / provenance
    operator_node.set_data('values', {}, sync=sync)
    operator_node.set_data('statuses', {}, sync=sync)

    operator = self.create_operator(name, attributes=attributes, properties=properties, sync=sync)

    self.set_node_entity(operator_node, operator, sync=sync)

    # set provenance
    self.set_node_provenance(operator_node)

    return operator_node

define_output(label=None, value=None, provenance=None, properties={}, sync=None)

Define an output node in the data pipeline.

Parameters:

Name Type Description Default
label

Node label.

None
value

Output value.

None
provenance

Provenance information.

None
properties

Node properties.

{}
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
def define_output(self, label=None, value=None, provenance=None, properties={}, sync=None):
    """
    Define an output node in the data pipeline.

    Parameters:
        label: Node label.
        value: Output value.
        provenance: Provenance information.
        properties: Node properties.
        sync: Synchronization flag.
    """
    output_node = self.create_node(label=label, type=str(NodeType.OUTPUT), properties=properties, sync=sync)

    # values / provenance
    output_node.set_data('values', {}, sync=sync)
    output_node.set_data('statuses', {}, sync=sync)

    # output value/stream
    self.set_node_value(output_node, value=value, provenance=provenance, sync=sync)

    # set provenance
    self.set_node_provenance(output_node)

    return output_node

get_attribute(key)

Get an attribute for the data pipeline.

Parameters:

Name Type Description Default
key str

Attribute key.

required

Returns:

Name Type Description
value

Attribute value or None if not found.

Source code in blue/data/pipeline.py
173
174
175
176
177
178
179
180
181
182
183
184
185
186
def get_attribute(self, key):
    """
    Get an attribute for the data pipeline.

    Parameters:
        key (str): Attribute key.

    Returns:
        value: Attribute value or None if not found.
    """
    attributes = self.get_attributes()
    if key in attributes:
        return attributes[key]
    return None

get_attributes()

Get all attributes for the data pipeline.

Returns:

Type Description
dict

Dictionary of attribute key-value pairs.

Source code in blue/data/pipeline.py
188
189
190
191
192
193
194
195
def get_attributes(self):
    """
    Get all attributes for the data pipeline.

    Returns:
        (dict): Dictionary of attribute key-value pairs.
    """
    return self.get_data("attributes")

get_node_status(n, provenance=None)

Get the node status for a node in the data pipeline, optionally filtered by provenance.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required
provenance

Provenance information.

None

Returns:

Type Description

Node status.

Source code in blue/data/pipeline.py
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
def get_node_status(self, n, provenance=None):
    """
    Get the node status for a node in the data pipeline, optionally filtered by provenance.

    Parameters:
        n: Node object, id, or label.
        provenance: Provenance information.

    Returns:
        Node status.
    """
    node = self.get_node(n)
    if provenance:
        statuses = node.get_data("statuses")
        if provenance in statuses:
            return statuses[provenance]
        else:
            return None
    else:
        return node.get_data("status")

get_node_statuses(n)

Get all node statuses for a node in the data pipeline.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required

Returns:

Name Type Description
dict

Dictionary of provenance-status pairs.

Source code in blue/data/pipeline.py
424
425
426
427
428
429
430
431
432
433
434
435
def get_node_statuses(self, n):
    """
    Get all node statuses for a node in the data pipeline.

    Parameters:
        n: Node object, id, or label.

    Returns:
        dict: Dictionary of provenance-status pairs.
    """
    node = self.get_node(n)
    return node.get_data("statuses")

get_node_value(n, provenance=None)

Get the node values for a node in the data pipeline, optionally filtered by provenance.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required
provenance

Provenance information.

None

Returns:

Type Description

Node value.

Source code in blue/data/pipeline.py
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
def get_node_value(self, n, provenance=None):
    """
    Get the node values for a node in the data pipeline, optionally filtered by provenance.

    Parameters:
        n: Node object, id, or label.
        provenance: Provenance information.

    Returns:
        Node value.
    """
    node = self.get_node(n)
    if provenance:
        values = node.get_data("values")
        if provenance in values:
            return values[provenance]
        else:
            return None
    else:
        return node.get_data("value")

get_node_values(n)

Get all node values for a node in the data pipeline.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required

Returns:

Name Type Description
dict

Dictionary of provenance-value pairs.

Source code in blue/data/pipeline.py
371
372
373
374
375
376
377
378
379
380
381
382
def get_node_values(self, n):
    """
    Get all node values for a node in the data pipeline.

    Parameters:
        n: Node object, id, or label.

    Returns:
        dict: Dictionary of provenance-value pairs.
    """
    node = self.get_node(n)
    return node.get_data("values")

get_plan_input(pipeline=None)

Get the plan input node for the data pipeline.

Parameters:

Name Type Description Default
pipeline

Pipeline entity or ID.

None

Returns:

Type Description

Plan input node.

Source code in blue/data/pipeline.py
261
262
263
264
265
266
267
268
269
270
271
272
def get_plan_input(self, pipeline=None):
    """
    Get the plan input node for the data pipeline.

    Parameters:
        pipeline: Pipeline entity or ID.

    Returns:
        Plan input node.
    """
    plan_input_id = self.get_plan_input_id(pipeline=pipeline)
    return self.get_node(plan_input_id)

get_plan_input_id(pipeline=None)

Get the plan input ID for the data pipeline.

Parameters:

Name Type Description Default
pipeline

Pipeline entity or ID.

None

Returns:

Type Description

Plan input ID.

Source code in blue/data/pipeline.py
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
def get_plan_input_id(self, pipeline=None):
    """
    Get the plan input ID for the data pipeline.

    Parameters:
        pipeline: Pipeline entity or ID.

    Returns:
        Plan input ID.
    """
    if pipeline is None:
        return self.get_data("input")
    else:
        pipeline_entity = self.get_entity(pipeline)
        return pipeline_entity.get_data("input")

get_plan_output(pipeline=None)

Get the plan output node for the data pipeline.

Parameters:

Name Type Description Default
pipeline

Pipeline entity or ID.

None

Returns:

Type Description

Plan output node.

Source code in blue/data/pipeline.py
317
318
319
320
321
322
323
324
325
326
327
328
def get_plan_output(self, pipeline=None):
    """
    Get the plan output node for the data pipeline.

    Parameters:
        pipeline: Pipeline entity or ID.

    Returns:
        Plan output node.
    """
    plan_output_id = self.get_plan_output_id(pipeline=pipeline)
    return self.get_node(plan_output_id)

get_plan_output_id(pipeline=None)

Get the plan output ID for the data pipeline.

Parameters:

Name Type Description Default
pipeline

Pipeline entity or ID.

None

Returns:

Type Description

Plan output ID.

Source code in blue/data/pipeline.py
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
def get_plan_output_id(self, pipeline=None):
    """
    Get the plan output ID for the data pipeline.

    Parameters:
        pipeline: Pipeline entity or ID.

    Returns:
        Plan output ID.
    """
    if pipeline is None:
        return self.get_data("output")
    else:
        pipeline_entity = self.get_entity(pipeline)
        return pipeline_entity.get_data("output")

get_plan_provenance()

Get the plan provenance for the data pipeline.

Returns:

Name Type Description
str

Plan provenance string.

Source code in blue/data/pipeline.py
208
209
210
211
212
213
214
215
def get_plan_provenance(self):
    """
    Get the plan provenance for the data pipeline.

    Returns:
        str: Plan provenance string.
    """
    return self.get_data("provenance")

set_attribute(key, value, sync=None)

Set an attribute for the data pipeline.

Parameters:

Name Type Description Default
key str

Attribute key.

required
value

Attribute value.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
159
160
161
162
163
164
165
166
167
168
169
170
171
def set_attribute(self, key, value, sync=None):
    """
    Set an attribute for the data pipeline.

    Parameters:
        key (str): Attribute key.
        value: Attribute value.
        sync: Synchronization flag.
    """
    attributes = self.get_attributes()
    attributes[key] = value

    self.synchronize(key="attributes." + key, value=value)

set_node_provenance(n)

Set the node provenance for a node in the data pipeline.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required
Source code in blue/data/pipeline.py
437
438
439
440
441
442
443
444
445
446
447
def set_node_provenance(self, n):
    """
    Set the node provenance for a node in the data pipeline.

    Parameters:
        n: Node object, id, or label.
    """
    node = self.get_node(n)

    plan_provenance = self.get_plan_provenance()
    node.set_data("provenance", plan_provenance + "." + self.get_id())

set_node_status(n, status=None, provenance=None, sync=None)

Set the node status for a node in the data pipeline, optionally for specific provenance.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required
status

Status to set.

None
provenance

Provenance information.

None
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
def set_node_status(self, n, status=None, provenance=None, sync=None):
    """
    Set the node status for a node in the data pipeline, optionally for specific provenance.

    Parameters:
        n: Node object, id, or label.
        status: Status to set.
        provenance: Provenance information.
        sync: Synchronization flag.
    """
    node = self.get_node(n)
    node.set_data("status", status, sync=sync)

    if provenance:
        statuses = node.get_data("statuses")
        statuses[provenance] = status

        node.synchronize(key="statuses." + provenance, value=status, sync=sync)

set_node_value(n, value=None, provenance=None, sync=None)

Set the node value for a node in the data pipeline.

Parameters:

Name Type Description Default
n

Node object, id, or label.

required
value

Value to set.

None
provenance

Provenance information.

None
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
def set_node_value(self, n, value=None, provenance=None, sync=None):
    """
    Set the node value for a node in the data pipeline.

    Parameters:
        n: Node object, id, or label.
        value: Value to set.
        provenance: Provenance information.
        sync: Synchronization flag.
    """
    node = self.get_node(n)
    node.set_data("value", value, sync=sync)

    if provenance:
        values = node.get_data("values")
        values[provenance] = value

        node.synchronize(key="values." + provenance, value=value, sync=sync)

set_plan_input(i, sync=None)

Set the plan input for the data pipeline.

Parameters:

Name Type Description Default
i

Input node object, id, or label.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
def set_plan_input(self, i, sync=None):
    """
    Set the plan input for the data pipeline.

    Parameters:
        i: Input node object, id, or label.
        sync: Synchronization flag.
    """
    input_id = i

    input_node = self.get_node(i)
    # internal node, get node id
    if input_node:
        input_id = input_node.get_id()

    self.set_data("input", input_id, sync=sync)

set_plan_input_id(input_id, sync=None)

Set the plan input node ID for the data pipeline.

Parameters:

Name Type Description Default
input_id

Input node ID.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
218
219
220
221
222
223
224
225
226
def set_plan_input_id(self, input_id, sync=None):
    """
    Set the plan input node ID for the data pipeline.

    Parameters:
        input_id: Input node ID.
        sync: Synchronization flag.
    """
    self.set_plan_input(input_id, sync=sync)

set_plan_output(o, sync=None)

Set the plan outputfor the data pipeline.

Parameters:

Name Type Description Default
o

Output node object, id, or label.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
def set_plan_output(self, o, sync=None):
    """
    Set the plan outputfor the data pipeline.

    Parameters:
        o: Output node object, id, or label.
        sync: Synchronization flag.
    """
    output_id = o

    output_node = self.get_node(o)
    # internal node, get node id
    if output_node:
        output_id = output_node.get_id()

    self.set_data("output", output_id, sync=sync)

set_plan_output_id(output_id, sync=None)

Set the plan output node ID for the data pipeline.

Parameters:

Name Type Description Default
output_id

Output node ID.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
274
275
276
277
278
279
280
281
282
def set_plan_output_id(self, output_id, sync=None):
    """
    Set the plan output node ID for the data pipeline.

    Parameters:
        output_id: Output node ID.
        sync: Synchronization flag.
    """
    self.set_plan_output(output_id, sync=sync)

set_plan_provenance(plan_provenance, sync=None)

Set the plan provenance for the data pipeline.

Parameters:

Name Type Description Default
plan_provenance str

Plan provenance string.

required
sync

Synchronization flag.

None
Source code in blue/data/pipeline.py
198
199
200
201
202
203
204
205
206
def set_plan_provenance(self, plan_provenance, sync=None):
    """
    Set the plan provenance for the data pipeline.

    Parameters:
        plan_provenance (str): Plan provenance string.
        sync: Synchronization flag.
    """
    self.set_data("provenance", plan_provenance, sync=sync)

Bases: Constant

Status of a node in a data pipeline:

  • INITED: node is created, initialized (e.g., input data is not processed yet)
  • REFINING: node is being refined (e.g., input data is being processed for refinement)
  • REFINED: node is refined (e.g., input data is processed for refinement)
  • EXECUTING: node is being executed (e.g., operator is being executed)
  • EXECUTED: node is executed (e.g., operator has finished executing)
  • PLANNED: node is planned (e.g., operator is planned to be executed)
  • FAILED: node has failed (e.g., operator has failed to execute)
Source code in blue/data/pipeline.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Status(Constant):
    """
    Status of a node in a data pipeline:

    - INITED: node is created, initialized (e.g., input data is not processed yet)
    - REFINING: node is being refined (e.g., input data is being processed for refinement)
    - REFINED: node is refined (e.g., input data is processed for refinement)
    - EXECUTING: node is being executed (e.g., operator is being executed)
    - EXECUTED: node is executed (e.g., operator has finished executing)
    - PLANNED: node is planned (e.g., operator is planned to be executed)
    - FAILED: node has failed (e.g., operator has failed to execute)
    """

    def __init__(self, c):
        super().__init__(c)

Bases: Constant

Type of a node in a data pipeline:

  • INPUT: node is an input node
  • OUTPUT: node is an output node
  • OPERATOR: node is an operator node
Source code in blue/data/pipeline.py
48
49
50
51
52
53
54
55
56
57
58
class NodeType(Constant):
    """
    Type of a node in a data pipeline:

    - INPUT: node is an input node
    - OUTPUT: node is an output node
    - OPERATOR: node is an operator node
    """

    def __init__(self, c):
        super().__init__(c)

Bases: Constant

Type of an entity in a data pipeline:

  • OPERATOR: entity is an operator
  • DATA_PIPELINE: entity is a data pipeline
Source code in blue/data/pipeline.py
66
67
68
69
70
71
72
73
74
75
class EntityType(Constant):
    """
    Type of an entity in a data pipeline:

    - OPERATOR: entity is an operator
    - DATA_PIPELINE: entity is a data pipeline
    """

    def __init__(self, c):
        super().__init__(c)
Last update: 2025-10-09