Repository: valohai/valohai-cli

Issue:
Priority argument should work as a flag in addition to a custom integer
This would allow easy priority setting in most cases with two basic priority classes: normal and high. Using the flag would set priority to 1.

Usage example:
```
% vh exec run urgent-job --priority
```

Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/valohai/valohai-cli/pull/321?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valohai) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 86.17%. Comparing base [(`cdc6cfb`)](https://app.codecov.io/gh/valohai/valohai-cli/commit/cdc6cfbc3670bb1947ebd6185bd3f670b66afe66?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valohai) to head [(`4bb5496`)](https://app.codecov.io/gh/valohai/valohai-cli/commit/4bb54969412860c240093979153f6436cf3fddf2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valohai).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
+ Coverage   86.16%   86.17%   +0.01%     
==========================================
  Files         129      129              
  Lines        4603     4607       +4     
  Branches      592      511      -81     
==========================================
+ Hits         3966     3970       +4     
  Misses        446      446              
  Partials      191      191              
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/valohai/valohai-cli/pull/321?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valohai).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=valohai).


Fix (patch):
diff --git a/valohai_cli/commands/execution/run/frontend_command.py b/valohai_cli/commands/execution/run/frontend_command.py
index 6fdcea9..2685c8a 100644
--- a/valohai_cli/commands/execution/run/frontend_command.py
+++ b/valohai_cli/commands/execution/run/frontend_command.py
@@ -122,6 +122,8 @@ EMPTY_DICT_PLACEHOLDER = object()
     "--priority",
     type=int,
     default=None,
+    is_flag=False,
+    flag_value=1,
     help="Priority for the job; higher values mean higher priority.",
 )
 @click.option(


Test changes:
diff --git a/tests/commands/execution/test_run.py b/tests/commands/execution/test_run.py
index 18c5819..4fbcdfc 100644
--- a/tests/commands/execution/test_run.py
+++ b/tests/commands/execution/test_run.py
@@ -434,3 +434,9 @@ def test_priority(run_test_setup, val):
     run_test_setup.args.append(f"--priority={val}")
     run_test_setup.run()
     assert run_test_setup.run_api_mock.last_create_execution_payload["priority"] == val
+
+
+def test_implicit_priority(run_test_setup):
+    run_test_setup.args.append("--priority")
+    run_test_setup.run()
+    assert run_test_setup.run_api_mock.last_create_execution_payload["priority"] == 1