I like James solution better, but the initial thought I had was to deploy airflowignore files to the environments to filter out files that should not be processed when filling the DagBag.
Chris On Mon, Oct 8, 2018 at 10:22 AM James Meickle <jmeic...@quantopian.com.invalid> wrote: > As long as the Airflow process can't find the DAG as a top-level object in > the module, it won't be registered. For example, we have a function that > returns DAGs; the function returns nothing if it's not in the right > environment. > > On Sun, Oct 7, 2018 at 2:31 PM Shah Altaf <mend...@gmail.com> wrote: > > > Hi all, > > > > tl;dr - Is it possible to conditionally hide a DAG from the UI based on > an > > environment variable? > > > > > > > > Our team has a single repo with several DAGs in it and we deploy it > across > > multiple 'environments' (think dev, test, and other integration > > environments). While most DAGs are meant to run everywhere, we do have > > several which are meant to run in one and only one environment. Of > course > > they are all paused, but it would be nice to declutter a bit for > ourselves. > > > > My question then - is it possible to conditionally hide a DAG from the UI > > based on an environment variable or some flag somewhere. > > > > This is just wishful thinking - the dev could do something like > > > > dag = get_dag(...),and get_dag() would have a decorator like > > @only_run_in("integration4,dev,local") > > > > And that decorator returns some kind of None object or special DAG which > > just doesn't appear in the list. > > > > Or perhaps some other way to accomplish this same effect - any ideas > would > > be appreciated. > > > > Thanks > > >