Hi Russell,

The least intrusive method is to write your own "on_failure_callback"
mechanism, not use the failure emails and then replicate the email handling
code there
with the ipgetter code. I'd then turn this into some common utility code
and look into using "default_args"  to have this set as the default for all
tasks.

Another reasonable way is to patch the core as a customization and then
call ipgetter in the failure method, so it only gets called when it needs
to.

The worst method is to find the taskinstance in an operator in
context['ti'], then override the taskinstance.hostname using your ipgetter
code in the 'execute()' method
of each operator.

Rgds,

Gerard


On Wed, Jul 19, 2017 at 11:07 PM, Russell Jurney <russell.jur...@gmail.com>
wrote:

> bump?
>
> Russell Jurney @rjurney <http://twitter.com/rjurney>
> russell.jur...@gmail.com LI <http://linkedin.com/in/russelljurney> FB
> <http://facebook.com/jurney> datasyndrome.com
>
> On Tue, Jul 18, 2017 at 4:36 PM, Russell Jurney <russell.jur...@gmail.com>
> wrote:
>
> > I created a JIRA to track this issue: https://issues.apache.
> > org/jira/browse/AIRFLOW-1425
> >
> > Russell Jurney @rjurney <http://twitter.com/rjurney>
> > russell.jur...@gmail.com LI <http://linkedin.com/in/russelljurney> FB
> > <http://facebook.com/jurney> datasyndrome.com
> >
> > On Tue, Jul 18, 2017 at 4:33 PM, Russell Jurney <
> russell.jur...@gmail.com>
> > wrote:
> >
> >> I need my Airflow emails to contain the external IP address of the
> >> machine, as determined by ipgetter.myip(). In terms of how it behaves
> this
> >> seems to work, as it times out after 2 seconds and returns null string
> if
> >> it doesn't get a reply.
> >>
> >> I can see where I can add this in TaskInstance, a field self.external_ip
> >> that is initialized to ipgetter.myip() and then referred to in the
> template
> >> for email below. However, that would get called each time a task is
> >> instantiated. This seems wrong. Is there a global place this could get
> run
> >> at system initialization time and then filled in after?
> >>
> >> Thanks!
> >>
> >> Russell Jurney @rjurney <http://twitter.com/rjurney>
> >> russell.jur...@gmail.com LI <http://linkedin.com/in/russelljurney> FB
> >> <http://facebook.com/jurney> datasyndrome.com
> >>
> >
> >
>

Reply via email to