Skip to content

Conversation

@cognifloyd
Copy link
Member

Background

This is another part of introducing pants, as discussed in various TSC meetings.

Related PRs can be found in:

Overview of this PR

This PR adds the st2_runner_python_distribution() macro to the BUILD metadata for all of our runners.

Thanks to the macro, we only have to define 3 (or 4) parameters for each runner: runner_name, description, entry_points, and (for the python runner) zip_safe=False. I copied each of these from the setup.py file, which will become obsolete once pants can generate the setup.py file for us. For the description, I tried to keep the spacing fairly consistent, but there was enough variation in the wording that I did not delegate creating the description to the macro.

Under entry_points, I have "tagged" the st2common.runners.runner and the orquesta.expressions.functions categories as stevedore_namespaces. Once we switch to 2.16 and enable the pants.backend.experimental.python.framework.stevedore plugin, the stevedore plugin will, for tests, use this "tag" to look up which wheels implement a plugin in that stevedore namespace.

To facilitate comparison, I will add a comment to each of the files that shows the current setup.py entry_points.

@cognifloyd cognifloyd added this to the pants milestone Feb 16, 2023
@cognifloyd cognifloyd self-assigned this Feb 16, 2023
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Feb 16, 2023
Comment on lines +8 to +10
stevedore_namespace("st2common.runners.runner"): {
"action-chain": "action_chain_runner.action_chain_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"action-chain = action_chain_runner.action_chain_runner",
],

Comment on lines +8 to +10
stevedore_namespace("st2common.runners.runner"): {
"announcement": "announcement_runner.announcement_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"announcement = announcement_runner.announcement_runner",
],

Comment on lines +8 to +9
stevedore_namespace("st2common.runners.runner"): {
"http-request": "http_runner.http_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"http-request = http_runner.http_runner",
],

Comment on lines +8 to +9
stevedore_namespace("st2common.runners.runner"): {
"inquirer": "inquirer_runner.inquirer_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"inquirer = inquirer_runner.inquirer_runner",
],

Comment on lines +8 to +11
stevedore_namespace("st2common.runners.runner"): {
"local-shell-cmd": "local_runner.local_shell_command_runner",
"local-shell-script": "local_runner.local_shell_script_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"local-shell-cmd = local_runner.local_shell_command_runner",
"local-shell-script = local_runner.local_shell_script_runner",
],

Comment on lines +8 to +9
stevedore_namespace("st2common.runners.runner"): {
"noop": "noop_runner.noop_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"noop = noop_runner.noop_runner",
],

Comment on lines +8 to +41
stevedore_namespace("st2common.runners.runner"): {
"orquesta": "orquesta_runner.orquesta_runner",
},
stevedore_namespace("orquesta.expressions.functions"): {
"st2kv": "orquesta_functions.st2kv:st2kv_",
"task": "orquesta_functions.runtime:task",
"basename": "st2common.expressions.functions.path:basename",
"dirname": "st2common.expressions.functions.path:dirname",
"from_json_string": "st2common.expressions.functions.data:from_json_string",
"from_yaml_string": "st2common.expressions.functions.data:from_yaml_string",
"json_dump": "st2common.expressions.functions.data:to_json_string",
"json_parse": "st2common.expressions.functions.data:from_json_string",
"json_escape": "st2common.expressions.functions.data:json_escape",
"jsonpath_query": "st2common.expressions.functions.data:jsonpath_query",
"regex_match": "st2common.expressions.functions.regex:regex_match",
"regex_replace": "st2common.expressions.functions.regex:regex_replace",
"regex_search": "st2common.expressions.functions.regex:regex_search",
"regex_substring": "st2common.expressions.functions.regex:regex_substring",
"to_human_time_from_seconds": "st2common.expressions.functions.time:to_human_time_from_seconds",
"to_json_string": "st2common.expressions.functions.data:to_json_string",
"to_yaml_string": "st2common.expressions.functions.data:to_yaml_string",
"use_none": "st2common.expressions.functions.data:use_none",
"version_compare": "st2common.expressions.functions.version:version_compare",
"version_more_than": "st2common.expressions.functions.version:version_more_than",
"version_less_than": "st2common.expressions.functions.version:version_less_than",
"version_equal": "st2common.expressions.functions.version:version_equal",
"version_match": "st2common.expressions.functions.version:version_match",
"version_bump_major": "st2common.expressions.functions.version:version_bump_major",
"version_bump_minor": "st2common.expressions.functions.version:version_bump_minor",
"version_bump_patch": "st2common.expressions.functions.version:version_bump_patch",
"version_strip_patch": "st2common.expressions.functions.version:version_strip_patch",
"yaml_dump": "st2common.expressions.functions.data:to_yaml_string",
"yaml_parse": "st2common.expressions.functions.data:from_yaml_string",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"orquesta = orquesta_runner.orquesta_runner",
],
"orquesta.expressions.functions": [
"st2kv = orquesta_functions.st2kv:st2kv_",
"task = orquesta_functions.runtime:task",
"basename = st2common.expressions.functions.path:basename",
"dirname = st2common.expressions.functions.path:dirname",
"from_json_string = st2common.expressions.functions.data:from_json_string",
"from_yaml_string = st2common.expressions.functions.data:from_yaml_string",
"json_dump = st2common.expressions.functions.data:to_json_string",
"json_parse = st2common.expressions.functions.data:from_json_string",
"json_escape = st2common.expressions.functions.data:json_escape",
"jsonpath_query = st2common.expressions.functions.data:jsonpath_query",
"regex_match = st2common.expressions.functions.regex:regex_match",
"regex_replace = st2common.expressions.functions.regex:regex_replace",
"regex_search = st2common.expressions.functions.regex:regex_search",
"regex_substring = st2common.expressions.functions.regex:regex_substring",
(
"to_human_time_from_seconds = "
"st2common.expressions.functions.time:to_human_time_from_seconds"
),
"to_json_string = st2common.expressions.functions.data:to_json_string",
"to_yaml_string = st2common.expressions.functions.data:to_yaml_string",
"use_none = st2common.expressions.functions.data:use_none",
"version_compare = st2common.expressions.functions.version:version_compare",
"version_more_than = st2common.expressions.functions.version:version_more_than",
"version_less_than = st2common.expressions.functions.version:version_less_than",
"version_equal = st2common.expressions.functions.version:version_equal",
"version_match = st2common.expressions.functions.version:version_match",
"version_bump_major = st2common.expressions.functions.version:version_bump_major",
"version_bump_minor = st2common.expressions.functions.version:version_bump_minor",
"version_bump_patch = st2common.expressions.functions.version:version_bump_patch",
"version_strip_patch = st2common.expressions.functions.version:version_strip_patch",
"yaml_dump = st2common.expressions.functions.data:to_yaml_string",
"yaml_parse = st2common.expressions.functions.data:from_yaml_string",
],

Comment on lines +8 to +9
stevedore_namespace("st2common.runners.runner"): {
"python-script": "python_runner.python_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"python-script = python_runner.python_runner",
],

Comment on lines +8 to +11
stevedore_namespace("st2common.runners.runner"): {
"remote-shell-cmd": "remote_runner.remote_command_runner",
"remote-shell-script": "remote_runner.remote_script_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"remote-shell-cmd = remote_runner.remote_command_runner",
"remote-shell-script = remote_runner.remote_script_runner",
],

Comment on lines +16 to +20
stevedore_namespace("st2common.runners.runner"): {
"winrm-cmd": "winrm_runner.winrm_command_runner",
"winrm-ps-cmd": "winrm_runner.winrm_ps_command_runner",
"winrm-ps-script": "winrm_runner.winrm_ps_script_runner",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"st2common.runners.runner": [
"winrm-cmd = winrm_runner.winrm_command_runner",
"winrm-ps-cmd = winrm_runner.winrm_ps_command_runner",
"winrm-ps-script = winrm_runner.winrm_ps_script_runner",
],

@cognifloyd cognifloyd force-pushed the pants-python_distributions-runners branch from 3166126 to 46ceea5 Compare February 16, 2023 23:09
@cognifloyd cognifloyd marked this pull request as ready for review February 16, 2023 23:10
@cognifloyd

This comment was marked as resolved.

@cognifloyd cognifloyd force-pushed the pants-python_distributions-runners branch from db7f769 to 14fb366 Compare February 24, 2023 17:45
Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggested on description as the winrm is 3 runners...

@cognifloyd cognifloyd force-pushed the pants-python_distributions-runners branch from a1b35f1 to cc74cc5 Compare February 27, 2023 17:51
@cognifloyd cognifloyd enabled auto-merge February 27, 2023 17:52
@cognifloyd cognifloyd requested a review from a team February 27, 2023 23:44
cognifloyd and others added 5 commits March 2, 2023 11:49
tag with stevedore_namespace so that once we enable the
pants-plugin for stevedore, pants can install things
appropriately for tests to access the setuptools metadata.
@cognifloyd cognifloyd force-pushed the pants-python_distributions-runners branch from cc74cc5 to 69c32d7 Compare March 2, 2023 17:50
@cognifloyd cognifloyd merged commit cd8bb4c into master Mar 2, 2023
@cognifloyd cognifloyd deleted the pants-python_distributions-runners branch March 2, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pantsbuild runners size/L PR that changes 100-499 lines. Requires some effort to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants