Is there a way to change hooks dynamically in Kedro? - kedro

I know I can add any CLI option via kedro_cli.py.
but I can't find out how to change what hooks are loaded dynamically.
I'm using kedro-mlflow, which features are provided via hooks.
And sometimes I don't want to log MLFlow temporarily.
If it's possible, please show me an example of ProjectContext code.

If the hooks have an entry-point as described in https://kedro.readthedocs.io/en/stable/07_extend_kedro/05_plugins.html#hooks , you would be able to disable it by specifying in .kedro.yml https://kedro.readthedocs.io/en/stable/07_extend_kedro/04_hooks.html#disable-auto-registered-plugins-hooks but you might have to ask the maintainer of kedro-mlflow plugin to add auto-registration first.

Related

How to avoid duplicate default configuration for Firefox add-on?

I'm trying to implement some customization for a WebExtensions add-on, but I'm running into code duplication: both the options UI script and the content script need to know the default values for each setting, and AFAIK I can't expect either of them to be run before the other. Is there an elegant way to ensure that the local storage is initialized before either of them run?
Try this. If the storage is never set, the default-value-1 and default-value-2 will be used.
let settings = await browser.storage.local.get({
option1: "default-value-1",
option2: "default-value-2"
});
See more here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/StorageArea/get

Liferay Hook for liferay-multi-vm-clustered.xml

I am trying to override the default liferay-multi-vm-clustered.xml for application level caching using a liferay hook. Any instruction or links? Already spent much time googling but didn't find anything useful.
Thanks in advance.
PS: Already know i can override it via manual deployment and portal.properties.
PPS: Sorry for the format new to stackoverflow.
I'm assuming that you're referring to Liferay 6.x
I'm not aware of any hook that can override this file. Specifically because hooks are only deployed after Liferay has fully been set up and started, it'd be changing the setup after the fact.
You can introduce a new file and reference it in portal-ext.properties. If you want to package this in a plugin, I'm afraid it'll be an ext-plugin. Even though I don't like to suggest using ext, in this case it's a well maintainable ext, so it does not bring the same maintenance-danger as code-containing ext plugins.

Overriding plugin behaviour in SonarQube 4.0

I'm trying to modify the behaviour of the NewIssuesEmailTemplate in SonarQube 4.0. I want to put richer information into the generated emails. It looks as if everything I need is put in the Notification by IssueNotifications.
What I want to know is if it's possible to override the fact that NewIssuesEmailTemplate is the handler for Notifications of type "new-issues".
I'm going to hazard that this can be done by creating a new plugin that overrides the specific behaviour of CorePlugin, and making sure that this gets loaded first, but I don't really know how to go about it.
Has anyone done anything like this before? I don't seem to be able to find any hints to get me started.
You cannot change the fact that NewIssuesEmailTemplate is the handler for notifications of type "new-issues".
All you can do is to add new channels or dispatchers using the extensions available in the notification API. You can check how this is done by the Core Email plugin.

Get uRapidFlow logs for an import profile batch

I am running a php script using a cron job to run a uRapidFlow / RapidFlow import profile. Here is the documented code I found to help me do this.
I need to be able to run through the imported batch, row by row, and do some processing based on if the row was imported successfully or not. It would also be very convenient and useful to be able to send email notifications on failed imports in general as well. If anyone has any idea, or can point me in the right direction, I would be very grateful. I don't see any documentation for this online, so I am going through the module code and database trying to figure it out myself.
I am using Magento EE 1.12.0.2
The best bet, unless you modify the uRapidFlow extension (check license information before doing so). Would be to extend it and use a observed event.
Try the observer : catalog_product_import_finish_before Which is triggered after each product is imported. Bare in mind this solution would be triggered globably for any manual imports, so if you build a small extension, perhaps make it easy to toggle on and off.
More can be found on Magento's observers here : http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Note as you've not specified which version of Magento you are using, you'll have to check if that observer is supported in your version.

Magento, how to disable module programmatically?

My goal is to disable the module programmatically (for example during some observer event).
The earliest observer I found is controller_front_init_before.
So my module is listening to it, and then do the next:
Mage::getConfig()->getModuleConfig('IG_LightBox')->active=(string)'false';
But the selected module is still active on each page.
Also I tried this approach (the same but in different way):
Mage::getConfig()->getNode('modules/IG_LightBox')->active=(string)'false';
Also I tried to reinit config after all and to loadModules one more time, but both won't help.
Mage::getConfig()->loadModules(); // won't help
Mage::getConfig()->reinit(); // won't help
Is it possible to disable the module programmatically?
Update 1.
This solution perfectly works for the back-end. active=false really disables the module, but I need it for the front-end too. So I keep my search.
Update 2
There are 2 methods in the app/Mage.php, called init and initSpecified, which allows to run the Magento with the selected number of modules only. But those methods are not called in the default flow.
Update 3
There is an observer event we can use for activating or deactivating the payment modules on the fly. It's called payment_method_is_active. This code example makes the check money order payment method being not active:
public function payment_method_is_active(Varien_Event_Observer $observer)
{
if($observer->getMethodInstance()->getCode()=='checkmo')
{
$observer->getResult()->isAvailable=false;
}
}
I think it depends on which kind of module you want to disable. My article worked for the kind of module I wanted to disable, but that module double-checked if it was activated, while most modules don't do that.
Magento loads all module configuration at once. Its impossible to create a module that will listen to this process because the module would have not been loaded while the process takes place. This creates a paradox. Its impossible to prevent a module from loading using another module.
As a result the only options you are left with are:
Edit the core.
Use modules which are better designed and explicitly allow themselves to be disabled through a config option or method.
Edit/extend the module you want to disable so that you can disable its functionality during runtime.
Hope this helps.. let me know if I can help you find a way to disable the module you're dealing with.
Here is one solution I found.

Resources