Writing a UNode
The UNode is the central piece of resource wrapping in our wrapping framework Urgap.
UNode Location
All UNodes are located in the following directory: urgap/unodes/
Choose a Template
The recommended starting point is the filter_tabular_to_csv UNode: urgap/unodes/filter_tabular_to_csv/filter_tabular_to_csv.py
Copy this implementation and adapt it for your use case.
UNode Structure
A UNode is a Python class that has the following components:
META_INFOdictionary__init__methodpreflightmethodoptional
postflightmethod
META_INFO Dictionary
nameMust match the class name.
wrapper_versionVersion of the wrapper implementation.
versionsDefines versions of the wrapped resource or executable.
exe_path must point to a file located in urgap/resources.
If the wrapped resource is a system resource, prefix the path with $:
"exe_path": "$fpreppy"
Input and Output UFTypes
Urgap identifies files using uftypes, which are file-type namespaces.
Uftypes are defined in: urgap/uftypes.py
UFTYPE Rules
output_uftypesmust be defined explicitlyinput_uftypesmay useANYnamespacesEach uftype must define:
min: minimum number of filesmax: maximum number of files (-1means unlimited)
Every output uftype must have
min > 0
preflight Method
The preflight method prepares the command-line execution.
The command is stored in: utrace.urun_dict.command_list
Build the command according to the resource CLI
Input and output file paths can be accessed using: utrace.output_files.get_path_objects_by_uftype(uftype)
Runtime parameters are available via: utrace.urun_dict.parameters
postflight Method
The optional postflight method is executed after the resource finishes and can:
Map output files if not handled by the CLI
Move or rename output files to expected output paths