Skip to content

Add Alteryx Engine methods to 'logger' or generic 'alteryx_engine' namespace #9

@daqieq

Description

@daqieq

This is generic version of this other issue -- #6.

While working on a tool using SnakePlane recently, I needed a temp directory for files. While I ended up using the Python tempfile package instead, I did try finding the TempFilePath workflow constant at one point.

It appears that the alteryx_engine inside AyxPlugin is hidden from the 'pilot', and as such, the output_message method is only exposed to the 'pilot' through the logger. So to get access to get_constant method, I added it temporarily to the self.logging SimpleNamespace following the pattern, and was able to use the following in Pdb:

(Pdb) logger.get_constant(0)
('Engine.GuiInteraction', '', '0', False)
(Pdb) logger.get_constant(1)
('Engine.IterationNumber', '', '0', True)
(Pdb) logger.get_constant(2)
('Engine.ModuleDirectory', '', 'C:\\Users\\<user>\\Documents\\~Alteryx\\snakeplane-master\\pilot\\debug_workflows\\', False)
(Pdb) logger.get_constant(3)
('Engine.TempFilePath', '', 'C:\\Users\\<user>\\AppData\\Local\\Temp\\Engine_7016_d592e2b9ab1c4a87b2c08afb64a01e81_\\', False)
(Pdb) logger.get_constant(4)
('Engine.Version', '', '2019.2.5.62427', False)
(Pdb) logger.get_constant(5)
('Engine.WorkflowDirectory', '', 'C:\\Users\\<user>\\Documents\\~Alteryx\\snakeplane-master\\pilot\\debug_workflows\\', False)
(Pdb) logger.get_constant(6)
('Engine.WorkflowFileName', '', './debug_workflows/SFTPInput.yxmd', False)

Does alteryx_engine need to be hidden in this fashion? If so, can we add some more features of the engine to either the logger, or a new SimpleNamespace? When I check dir(sdk.AlteryxEngine) I see the following methods that could be valuable to 'pilot':

[..., 'create_connect_metadata', 'create_temp_file_name', 'debug_message_out', 'decrypt_password', 'field_conversion_error_limit', 'get_constant', 'get_init_var', 'output_message', 'output_tool_progress', 'pre_sort', 'xmsg']

Several of these look indispensable! And the change to helper_classes for get_constant was simple enough:

            ...
            get_constant=partial(
                self._engine_vars.alteryx_engine.get_constant,
                self._engine_vars.n_tool_id,
            ),
            ...

Thank you for considering!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions