<h3 dir="auto">Description</h3>
<p dir="auto">At the moment it seems you can't trigger a dag with the CLI with the flag "replace_microseconds":</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/apache/airflow/blob/9337aa92c082db36e82eb314585591394fe8ff27/airflow/cli/commands/dag_command.py#L145">airflow/airflow/cli/commands/dag_command.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 145
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/9337aa92c082db36e82eb314585591394fe8ff27">9337aa9</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L145" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="145"></td>
          <td id="LC145" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">dag_id</span><span class="pl-c1">=</span><span class="pl-s1">args</span>.<span class="pl-s1">dag_id</span>, <span class="pl-s1">run_id</span><span class="pl-c1">=</span><span class="pl-s1">args</span>.<span class="pl-s1">run_id</span>, <span class="pl-s1">conf</span><span class="pl-c1">=</span><span class="pl-s1">args</span>.<span class="pl-s1">conf</span>, <span class="pl-s1">execution_date</span><span class="pl-c1">=</span><span class="pl-s1">args</span>.<span class="pl-s1">exec_date</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">However, this argument seems to be available in the "trigger_dag" function:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/apache/airflow/blob/9337aa92c082db36e82eb314585591394fe8ff27/airflow/api/common/trigger_dag.py#L103">airflow/airflow/api/common/trigger_dag.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 103
      in
      <a data-pjax="true" class="commit-tease-sha" href="/apache/airflow/commit/9337aa92c082db36e82eb314585591394fe8ff27">9337aa9</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L103" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="103"></td>
          <td id="LC103" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">def</span> <span class="pl-en">trigger_dag</span>( </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">The proposal is to add this flag, e.g: airflow dags trigger --replace_microseconds=False ...</p>
<p dir="auto">I'm willing to implement this, just wanted to check if this is a changed that is okay</p>
<h3 dir="auto">Use case/motivation</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Related issues</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit a PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<h3 dir="auto">Description</h3>
<p dir="auto"><code class="notranslate">airflow dags trigger</code> CLI command always defaults with <code class="notranslate">replace_microseconds=True</code> because of the default value in the API. It would be very nice to be able to control this flag from the CLI.</p>
<h3 dir="auto">Use case/motivation</h3>
<p dir="auto">We use AWS MWAA. The exposed interface is Airflow CLI (yes, we could also ask to get a different interface from AWS MWAA, but I think this is something that was just overlooked for the CLI?), which does not support overriding <code class="notranslate">replace_microseconds</code> parameter when calling <code class="notranslate">airflow dags trigger</code> CLI command.</p>
<p dir="auto">For the most part, our dag runs for a given dag do not happen remotely at the same time. However, based on user behavior, they are sometimes triggered within the same second (albeit not microsecond). The first dag run is successfully triggered, but the second dag run fails the <code class="notranslate">replace_microseconds</code> parameter is wiping out the microseconds that we pass. Thus, DagRun.find_duplicates returns True for the second dag run that we're trying to trigger, and this raises the <code class="notranslate">DagRunAlreadyExists</code> exception.</p>
<h3 dir="auto">Related issues</h3>
<p dir="auto">Not quite - they all seem to be around the experimental api and not directly related to the CLI.</p>
<h3 dir="auto">Are you willing to submit a PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>