|
21 | 21 | import warnings |
22 | 22 | from datetime import datetime |
23 | 23 | from pathlib import Path |
| 24 | +from uuid import uuid4 |
24 | 25 |
|
25 | 26 | from robot.errors import DataError, FrameworkError |
26 | 27 | from robot.output import LOGGER, LogLevel |
@@ -502,8 +503,10 @@ class RobotSettings(_BaseSettings): |
502 | 503 | "ConsoleMarkers" : ("consolemarkers", "AUTO"), |
503 | 504 | "DebugFile" : ("debugfile", None), |
504 | 505 | "Language" : ("language", []), |
| 506 | + "ExecutionId" : ("executionid", None), |
505 | 507 | } # fmt: skip |
506 | 508 | _languages = None |
| 509 | + _execution_id = None |
507 | 510 |
|
508 | 511 | def get_rebot_settings(self): |
509 | 512 | settings = RebotSettings() |
@@ -553,6 +556,18 @@ def languages(self): |
553 | 556 | self._raise_invalid("Language", err) |
554 | 557 | return self._languages |
555 | 558 |
|
| 559 | + @property |
| 560 | + def execution_id(self): |
| 561 | + """Unique ID for the current execution. |
| 562 | +
|
| 563 | + Given with the ``--executionid`` option or, by default, a generated |
| 564 | + UUID. The value is generated only once and cached so that it stays the |
| 565 | + same throughout the execution. |
| 566 | + """ |
| 567 | + if self._execution_id is None: |
| 568 | + self._execution_id = self["ExecutionId"] or str(uuid4()) |
| 569 | + return self._execution_id |
| 570 | + |
556 | 571 | @property |
557 | 572 | def suite_config(self): |
558 | 573 | return { |
|
0 commit comments