Skip to content

bogus_aeromain

A bogus Aeromain for testing Aeromancy outside of Aeromancy projects.

This is enough to test both --dev mode. You can launch it with something like:

shell> pdm debug_runner --aeromain src/bogus_aeromain.py --dev

Beyond that, flags are as they would be for a normal pdm go in an Aeromancy project repo.

TODO: Full Docker integration doesn't currently work.

BogusActionBuilder #

Bases: ActionBuilder

Bogus Aeromancy ActionBuilder for testing.

Creates a single BogusAction.

Source code in src/bogus_aeromain.py
83
84
85
86
87
88
89
90
91
92
93
94
class BogusActionBuilder(ActionBuilder):
    """Bogus Aeromancy `ActionBuilder` for testing.

    Creates a single `BogusAction`.
    """

    @override
    def build_actions(self) -> list[Action]:
        actions = []
        parent_action = self.add_action(actions, BogusParentAction(parents=[]))
        self.add_action(actions, BogusChildAction(parents=[parent_action]))
        return actions

BogusChildAction #

Bases: Action

Bogus Aeromancy Action for testing.

Prints a message to let you know it ran and reads an input artifact from the parent.

Source code in src/bogus_aeromain.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
class BogusChildAction(Action):
    """Bogus Aeromancy `Action` for testing.

    Prints a message to let you know it ran and reads an input artifact from the
    parent.
    """

    job_type = "child"
    job_group = "bogus"

    @override
    def outputs(self) -> list[str]:
        return ["bogus-child"]

    @override
    def run(self, tracker: Tracker) -> None:
        [input_artifact], _ = self.get_io()
        [input_path] = tracker.declare_input(input_artifact)

        print("Hello world from BogusChildAction.")
        print(
            "Parent action created artifact with this text: "
            f"{input_path.read_text()!r}",
        )

BogusParentAction #

Bases: Action

Bogus Aeromancy Action for testing.

Prints a message to let you know it ran and creates an output artifact.

Source code in src/bogus_aeromain.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class BogusParentAction(Action):
    """Bogus Aeromancy `Action` for testing.

    Prints a message to let you know it ran and creates an output artifact.
    """

    job_type = "parent"
    job_group = "bogus"

    @override
    def outputs(self) -> list[str]:
        return ["bogus-parent"]

    @override
    def run(self, tracker: Tracker) -> None:
        output_path = Path("/tmp/bogus-output1.txt")  # noqa: S108
        output_path.write_text("BogusParentAction output!\n")

        [output_name] = self.outputs()
        tracker.declare_output(
            name=output_name,
            local_filenames=[output_path],
            s3_destination=S3Object("bogus-bucket", "key1/"),
            artifact_type="bogus-artifact",
            metadata={"meaning-of-life": 42},
            strip_prefix=Path("/tmp"),  # noqa: S108
        )
        print("Hello world from BogusParentAction.")

aeromain(**aeromancy_options) #

CLI application with a minimal Aeromain for Aeromancy development.

Source code in src/bogus_aeromain.py
 97
 98
 99
100
101
102
103
104
105
106
107
@click.command()
@aeromancy_click_options
def aeromain(
    **aeromancy_options,
):
    """CLI application with a minimal Aeromain for Aeromancy development."""
    console.rule("[bold green][Bogus Aeromain][/bold green] Started!")
    action_builder = BogusActionBuilder(project_name="aeromancy-debug")
    action_runner = action_builder.to_runner()
    action_runner.run_actions(**aeromancy_options)
    console.rule("[bold green][Bogus Aeromain][/bold green] Done!")