task.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #
  2. # Copyright 2019 The FATE Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. import click
  17. from flow_client.flow_cli.utils import cli_args
  18. from flow_client.flow_cli.utils.cli_utils import preprocess, access_server
  19. @click.group(short_help="Task Operations")
  20. @click.pass_context
  21. def task(ctx):
  22. """
  23. \b
  24. Provides numbers of task operational commands, including list and query.
  25. For more details, please check out the help text.
  26. """
  27. pass
  28. @task.command("list", short_help="List Task Command")
  29. @cli_args.LIMIT
  30. @click.pass_context
  31. def list_task(ctx, **kwargs):
  32. """
  33. \b
  34. - DESCRIPTION:
  35. List Task description
  36. \b
  37. - USAGE:
  38. flow task list
  39. flow task list -l 25
  40. """
  41. config_data, dsl_data = preprocess(**kwargs)
  42. access_server('post', ctx, 'job/list/task', config_data)
  43. @task.command("query", short_help="Query Task Command")
  44. @cli_args.JOBID
  45. @cli_args.ROLE
  46. @cli_args.PARTYID
  47. @cli_args.COMPONENT_NAME
  48. @cli_args.STATUS
  49. @click.pass_context
  50. def query(ctx, **kwargs):
  51. """
  52. \b
  53. - DESCRIPTION:
  54. Query Task Command.
  55. \b
  56. - USAGE:
  57. flow task query -j $JOB_ID -p 9999 -r guest
  58. flow task query -cpn hetero_feature_binning_0 -s success
  59. """
  60. config_data, dsl_data = preprocess(**kwargs)
  61. access_server('post', ctx, 'job/task/query', config_data)