title: How can I find out if a DAG is paused/unpaused in Airflow?
body: <p>I would like to pause DAGs that are idle and redundant, How do I know which DAGs are unpaused and which are paused?</p>
  
  <p>So I have a list of DAGs that are to be unpaused using a bashcommand that executes <code>airflow pause &lt;dag_id&gt;</code>. I would like to know if the command is successful or not by checking the state of <code>pause</code> of each DAGs. I've checked the <code>airflow webserver</code> and it seems that all of my paused DAGs are still running.</p>
  
  <pre><code>def pause_idle_dags(dags = ["myTutorial"]):
      """
      Pauses dags from the airflow
      :param dags: dags considered to be idle
      :return: Success state
      """
      # TODO
      for dag in dags:
          command = "airflow pause {}".format(dag)
          print(executeBashCommand(command))
  
  def executeBashCommand(command):
      print('========RUN========', command)
      p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout, stderr = p.communicate()
      if p.returncode != 0:
          print('========STDOUT========\n',stdout.decode())
          print('========STDERR========\n',stderr.decode())
          raise Exception('There is error while executing bash command: '+command+'\nwith log:\n'+stderr.decode())
      return stdout, stderr
  </code></pre>