Migrate plugin between azul-runner versions
Note that version was reset to conform to azul-app chart versions
7.0
- Moved
test_template.pyto a foldertest_utilsand made it an extra import so nowazul_runner[test_utils]will need to be added to therequirements_test.txtfile, and imported from theazul_runnerorazul_runner.test_utilspackage. - Removed
TestLoadshould be replaced withFileManagerwhich is exported byazul_runner.test_utilsandazul_runner load_carthas been removed from the plugin test and need to be replaced withload_test_file_bytesorload_test_file_pathload_rawhas been renamed toload_local_raw
6.0
- Remove support for config
filter_gjson - Removed
filter_data_types_legacy - A number of properties on Event() classes (used in tests) were renamed and 'entity_type' was removed.
- For backwards compatibility, legacy names are renamed dynamically with a deprecation warning.
- Removed plugin property ENTITY_TYPE, all plugins implicitly operate on 'binary' events.
- Remove several obsolete property checks from legacy releases (all plugins have been updated)
5.0
No breaking changes
Legacy releases (before version realignment)
Legacy 6.0
Changes azul-runner to using multiprocessing ('forkserver') by default from previous threading model.
-
assertFormattedhas been replaced withassertJobResultsDictandassertReprEqual -
do_executionloop replaced withprovided_coordinatoralsono_multiprocessingwas added -
New setting
use_multiprocessing_forkto change multiprocessing over to 'fork' from 'forkserver'.
Legacy 5.0
- config changes:
filter_require_dataremoved- use
filter_allow_event_types=[]to select specific event types to process - use
assume_streams_available=trueto catch errors accessing underlying streams
- use
filter_deny_event_typesremoved- use
filter_allow_event_types=[]
- use
Legacy 4.0
- config & metadata changes:
- overrides for existing config options defined in Settings() do not require type information
add_custom_config_settings()->add_settings()REQUIRES_DATA = x->add_settings(filter_require_data: x)INPUT_DATA = x->add_settings(filter_data_types_legacy: x)ADDITIONAL_INPUT_CRITERIA = x->add_settings(filter_gjson: x)add_settings(max_file_size=x)->add_settings(filter_max_content_size: x)DEFAULT_CONFIGS->SETTINGSOUTPUT_FEATURES->FEATURES- add more dispatcher filters to runner settings (
filter_settings) - export
TestPluginfromtest_template - remove legacy plugin
self.configdictionary
Legacy 3.45
Not a breaking change, but some options deprecated
Filepath()should be removed, use a string instance insteadUri()should be removed, use a string instance insteadFeature()type=argument now should use FeatureType.String, FeatureType.Filepath, FeatureType.Binary, etc.
Legacy 3.1 to 3.2
- Plugin metadata now requires security to be defined as a string instead of a dict
- security is still optional, if unset, security is assumed to be 'OFFICIAL'
- Incoming events your plugin processes (which you have no control over) may have security as either a dict or str, don't worry about it
- Replace config option
security_exclusivewithsecurity_overridewhich accepts a security string SECURITYproperty replace security dict/list/str with only security string- The
Securityclass has been removed- If you were inspecting security objects at runtime for some reason, you will need to handle both dict and str cases.
- See here for more information
Legacy 3.0 to 3.1
Plugin code
- Replace import
EntitywithJob - Replace import
BinaryTemplatewithBinaryPlugin REQUIRES_DATAis set as true inBinaryPluginand can be removed- Base class should now be
BinaryPluginnotBinaryTemplate - Rename
INPUT_CONTENTplugin property toINPUT_DATA - Rename
RunResulttoState - Rename
RunResultEnumtoState.Label FEATURESwith unspecified types now default tostr- Change
def execute_binary(self, entity: Entity, data: Optional[StorageProxyFile]) -> dict:todef execute(self, job: Job): - Read
dataviadata = job.get_data()- Read non-content data via
job.get_data('text')orjob.get_all_data('pcap') job.get_data('text')will error if more than one stream is available with thetextlabel (replacesget_stream())job.get_all_data('pcap')to return streams of a certain type, or all streams with no parameter (replacesget_streams())
- Read non-content data via
- Feature values, info, children are managed via Event instances.
- The main Event has helpers on BinaryTemplate
self.add_feature_values(feature, values)to set values for a specific featureself.add_many_feature_values(feature_values)to set many features with a dict- Prefer usage of
self.add_feature_values()for readability
- Prefer usage of
self.add_info(info)to set info
- Adding children returns a new Event instance
self.add_binary(b"data", {"relation":"ship"})is replaced withc = self.add_child_with_data({"relation":"ship"}, b"data")c.add_feature_values()c.add_many_feature_values()c.add_info()gc = c.add_child_with_data()returns new Event instance and supports grandchildren and further
- Adding features, info for particular existing data streams
ds = self.get_data_event(hash)returns Event object (replacesper_stream)- Event functions used to add data, as described for children
- The main Event has helpers on BinaryTemplate
Test code
- Add imports
from azul_runner import Event, FV, JobResult, State, test_template - self.do_execution returns a
JobResult()instance instead of a dictionary - Use
self.assertJobResult(run_result, JobResult(...))instead ofself.assertEqualto make error checking render nicely - When developing tests, use
self.assertJobResult(run_result, None)to print the received output of run_result that you can copy+paste to replaceNone.- After copy+pasting, use
black .to transform the long JobResult(...) into a nicely formatted multiline output. - Make sure to check this output is as you expected.
- After copy+pasting, use