Airflow Cluster Policy is not getting invoked - airflow

I am trying to setup and understand custom policy. Not sure what I am doing wrong however, following this is not working.
Airflow Version: 1.10.10
Expected result: it should throw exception if I try to run DAG with default_owner
Actual Result: no such exception
/root/airflow/config/airflow_local_settings.py
class PolicyError(Exception):
pass
def cluster_policy(task):
print("task_instance_mutation_hook")
raise PolicyError
def task_instance_mutation_hook(ti):
print("task_instance_mutation_hook")
raise PolicyError
/root/airflow/config/airflow_local_settings.pyc file is being created so I know this file is being processed by airflow.
if there is any compilation error in this file all my dags fails. however not with above file.
Not sure what I am doing wrong.

This feature is available from 1.10.12 version only.

Related

Getting error while making a new dag in apache airflow

PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id create_tag_template_field_result is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
First , This is just a warning that for now but from version 2.0 of Airflow, it will raise exception, so can crash your pipeline if not handled (given you update airflow module)
Warning suggests that you are adding a task twice or using same id (create_tag_template_field_result) for two different tasks, which is causing this warning.

TypeError: module.exports.v1 is not a constructor, error thrown from google-cloud/firestore when using firebase-admin sdk

Recently I encountered the above error (TypeError: module.exports.v1 is not a constructor) when trying to run firebase-firestore related tests. Earlier I had no issue running the tests but after doing a npm install was getting the above error.
The source of the error is from google-cloud/firestore which is required by firebase-admin.
Tried several options but it doesn't seems to get resolved. I then tried with an older node-module and it worked as expected.
The problem was due to the test framework I've been using. Once I changed from jest to mocha the problem got solved.
When I updated firebase admin sdk from 8.4.0 to higher then I had same error in running jest test code.
I fixed it to add --env node option for jest.
jest --env node
I hit this error when I left out an await on an async function. That caused my code to continue running after the jest environment had been torn down.
There was a message that said ReferenceError: You are trying to import a file after the Jest environment has been torn down. which should have been a tip that I was running async code and not waiting for completion.
We needed to upgrade node from v8.11.3 to v8.16.2.

Corda throws error trying to generate the basic nodes

Am trying to generate the basic nodes- PartyA, PartyB and Notary on Ubuntu 14 by running ./gradlew deployNodes or even ./gradlew clean deployNodes. The error reads:
... still waiting. If this is taking longer than usual, check the node logs.
Error while generating node info file /cordapp-template-java/build/nodes/Notary/logs
Error while generating node info file /cordapp-template-java/build/nodes/PartyB/logs
Error while generating node info file /cordapp-template-java/build/nodes/PartyA/logs
Task :deployNodes FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':deployNodes'.
Error while generating node info file. Please check the logs in /cordapp-template-java/build/nodes/Notary/logs.
Error while generating node info file. Please check the logs in /cordapp-template-java/build/nodes/Notary/logs.
The error logs do not provide any indication of error.
I have personally run into the above question myself. From what I saw, it seems it was a random incident on the Unix based machine.
The issue was resolved after I moved the project to the different location. It is absurd. But I have never ran into this issue ever again.

Mocha coverage task fails and propagates exception to grunt which aborts the whole execution

I am using grunt-mocha-istanbul and have a task which runs the coverage through set of test files. The reporter is set to mocha-junit-reporter which generates the mocha test results XML file and the coverage report formats are set to cobertura and html.
For some reason, an error in the tests causes the whole task to fail and not just to get details on the failed test in the end report.
I ran the grunt task using --stack argument which produced the following:
Error: Task "mocha_istanbul:coveralls" failed.
at Task.<anonymous> (~\node_modules\grunt\lib\util\task.js:205:15)
at null._onTimeout (~\node_modules\grunt\lib\util\task.js:241:33)
at Timer.listOnTimeout (timers.js:92:15)
As you can see, this hides the original error somehow.
I defined a separate task to just run the tests and saw the issue but it has nothing to do with how the test execution in terms of callbacks gets handled.
So my question is, how can I intercept such propagated exceptions and provide more detailed information on what actually happened?

MbUnit tests pass when run directly from visual studio, but fails when run via command line

I've been using MbUnit for unit testing for a while, along with Nhibernate and Sqlite.
I am now trying to setup a CI server with Jenkins - I have successfully managed to configure Jenkins to pull the code from github and compile it using MSBuild everytime anyone pushes to github. Finally I want to run tests on the code on each successful build.
The tests all run successfully when run from within Visual Studio without any problem whatsoever, I can run each test individually or the whole project and they all run OK. However when I call Gallio.Echo.exe from command line all the tests that have to do with Sqlite fails.
This is what I've been doing to run the test from command line:
"C:\Program Files\Gallio\bin\Gallio.Echo.exe" /report-type:Html /verbosity:quiet "D:\MyProject\MyProject.Tests\bin\Debug\*.Tests.dll"
(ps: There seems to be absolutely no documentation about gallio tools - have I been looking in all the wrong palces? I want to find more about the command line arguments that I can pass)
The tests fail with this:
Gallio Echo - Version 3.3 build 454
Get the latest version at http://www.gallio.org/
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[failed] Fixture MyProject.Tests/VerificationTests
Set Up
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
HResult: -2147024809
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor()
--- End of inner exception stack trace ---
I've tried a few solutions mentioned around on SO but haven't been able to solve it. The only close thing was this answer but I am not sure what the user means by adding to config files.
Anyone has any idea why the tests fail from command line but are okay when run from within VS please?
Thanks.

Resources