Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Python 3.7; build for Jammy" #879

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ jobs:
fail-fast: false
matrix:
toxenv:
- py37,docs
- py36,docs
- cluster_itests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.6
# GHA won't setup tox for us and we use tox-pip-extensions for venv-update
- run: pip install tox==3.2 tox-pip-extensions==1.3.0
# there are no pre-built wheels for bsddb3, so we need to install
Expand All @@ -31,12 +32,12 @@ jobs:
strategy:
fail-fast: false
matrix:
dist: [bionic, jammy]
dist: [bionic]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.6
# the container provided by GitHub doesn't include utilities
# needed for dpkg building, so we need to install `devscripts`
# to bring those in
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
default_language_version:
python: python3.7
python: python3.6
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
Expand Down Expand Up @@ -30,7 +30,7 @@ repos:
rev: v2.0.2
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py36-plus]
- repo: local
hooks:
- id: patch-enforce-autospec
Expand All @@ -46,8 +46,8 @@ repos:
language: system
files: ^tronweb2/src/.*\.js$
- repo: http://github.com/psf/black
rev: 22.3.0
rev: 19.10b0
hooks:
- id: black
language_version: python3.7
args: [--target-version, py37]
language_version: python3.6
args: [--target-version, py36]
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ else
ADD_MISSING_DEPS_MAYBE:=$(NOOP)
endif

.PHONY : all clean tests docs dev
.PHONY : all clean tests docs dev cluster_itests

-usage:
@echo "make test - Run tests"
@echo "make deb_bionic - Generate bionic deb package"
@echo "make itest_bionic - Run tests and integration checks"
@echo "make _itest_bionic - Run only integration checks"
@echo "make deb_jammy - Generate bionic deb package"
@echo "make itest_jammy - Run tests and integration checks"
@echo "make _itest_jammy - Run only integration checks"
@echo "make release - Prepare debian info for new release"
@echo "make clean - Get rid of scratch and byte files"
@echo "make dev - Get a local copy of trond running in debug mode in the foreground"
Expand Down Expand Up @@ -74,10 +71,10 @@ react_%: docker_%
'

test:
tox -e py37
tox -e py36

test_in_docker_%: docker_%
$(DOCKER_RUN) tron-builder-$* python3.7 -m tox -vv -e py37
$(DOCKER_RUN) tron-builder-$* python3.6 -m tox -vv -e py36

tox_%:
tox -e $*
Expand All @@ -91,14 +88,17 @@ debitest_%: deb_% _itest_%
itest_%: debitest_%
@echo "itest $* OK"

cluster_itests:
tox -e cluster_itests

dev:
SSH_AUTH_SOCK=$(SSH_AUTH_SOCK) .tox/py37/bin/trond --debug --working-dir=dev -l logging.conf --host=0.0.0.0
SSH_AUTH_SOCK=$(SSH_AUTH_SOCK) .tox/py36/bin/trond --debug --working-dir=dev -l logging.conf --host=0.0.0.0

example_cluster:
tox -e example-cluster

yelpy:
.tox/py37/bin/pip-custom-platform install -i https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt
.tox/py36/bin/pip-custom-platform install -i https://pypi.yelpcorp.com/simple -r yelp_package/extra_requirements_yelp.txt

LAST_COMMIT_MSG = $(shell git log -1 --pretty=%B | sed -e 's/[\x27\x22]/\\\x27/g')
release: docker_bionic docs
Expand Down
70 changes: 15 additions & 55 deletions bin/tronctl
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,24 @@ COMMAND_HELP = (
"job name, job run id, or action id",
"Start the selected job, job run, or action. Creates a new job run if starting a job.",
),
(
"rerun",
"job run id",
"Start a new job run with the same start time command context as the given job run.",
),
("rerun", "job run id", "Start a new job run with the same start time command context as the given job run.",),
(
"retry",
"action id",
"Re-run a job action within an existing job run. Uses latest code/config except the command by default. Add --use-latest-command to use the latest command.",
),
("recover", "action id", "Ask Tron to start tracking an UNKNOWN action run again"),
("cancel", "job run id", "Cancel the selected job run."),
(
"backfill",
"job name",
"Start job runs for a particular date range",
),
("backfill", "job name", "Start job runs for a particular date range",),
("disable", "job name", "Disable selected job and cancel any outstanding runs"),
("enable", "job name", "Enable the selected job and schedule the next run"),
(
"fail",
"job run or action id",
"Mark an UNKNOWN job or action as failed. Does not publish action triggers.",
),
("fail", "job run or action id", "Mark an UNKNOWN job or action as failed. Does not publish action triggers.",),
(
"success",
"job run or action id",
"Mark an UNKNOWN job or action as having succeeded. Will publish action triggers.",
),
(
"skip",
"action id",
"Skip a failed action, unblocks dependent actions. Does *not* publish action triggers.",
),
("skip", "action id", "Skip a failed action, unblocks dependent actions. Does *not* publish action triggers.",),
(
"skip-and-publish",
"action id",
Expand Down Expand Up @@ -115,20 +99,14 @@ def parse_cli():

# start
cmd_parsers["start"].add_argument(
"--run-date",
type=parse_date,
dest="run_date",
help="What the run-date should be set to",
"--run-date", type=parse_date, dest="run_date", help="What the run-date should be set to",
)

# backfill
backfill_parser = cmd_parsers["backfill"]
mutex_dates_group = backfill_parser.add_mutually_exclusive_group(required=True)
mutex_dates_group.add_argument(
"--start-date",
type=parse_date,
dest="start_date",
help="First run-date to backfill",
"--start-date", type=parse_date, dest="start_date", help="First run-date to backfill",
)
backfill_parser.add_argument(
"--end-date",
Expand Down Expand Up @@ -235,16 +213,14 @@ def request(url: str, data: Dict[str, Any], headers=None, method=None) -> bool:
def event_publish(args):
for event in args.id:
yield request(
urljoin(args.server, "/api/events"),
dict(command="publish", event=event),
urljoin(args.server, "/api/events"), dict(command="publish", event=event),
)


def event_discard(args):
for event in args.id:
yield request(
urljoin(args.server, "/api/events"),
dict(command="discard", event=event),
urljoin(args.server, "/api/events"), dict(command="discard", event=event),
)


Expand All @@ -258,10 +234,7 @@ def _get_triggers_for_action(server: str, action_identifier: str) -> Optional[Tu
return None

trigger_response = client.request(
uri=urljoin(
server,
f"/api/jobs/{namespace}.{job_name}/{run_number}/{action_name}",
),
uri=urljoin(server, f"/api/jobs/{namespace}.{job_name}/{run_number}/{action_name}",),
)
if trigger_response.error:
print(f"Unable to fetch downstream triggers for {action_identifier}: {trigger_response.error}")
Expand All @@ -281,28 +254,17 @@ def control_objects(args: argparse.Namespace):
url_index = tron_client.index()
for identifier in args.id:
try:
tron_id = client.get_object_type_from_identifier(
url_index,
identifier,
)
tron_id = client.get_object_type_from_identifier(url_index, identifier,)
except ValueError as e:
possibilities = list(
tron_jobs_completer(prefix="", client=tron_client),
)
suggestions = suggest_possibilities(
word=identifier,
possibilities=possibilities,
)
possibilities = list(tron_jobs_completer(prefix="", client=tron_client),)
suggestions = suggest_possibilities(word=identifier, possibilities=possibilities,)
raise SystemExit(f"Error: {e}{suggestions}")

if args.command == "skip-and-publish":
# this command is more of a pseudo-command - skip and publish are handled in two different resources
# and changing the API would be painful, so instead we call skip + publish separately from the client
# (i.e., this file) to implement this functionality
if request(
url=urljoin(args.server, tron_id.url),
data={"command": "skip"},
):
if request(url=urljoin(args.server, tron_id.url), data={"command": "skip"},):
# a single action can have 0..N triggers to publish and these can be arbitrarily named, so we need to
# query the API and figure out what triggers exist
triggers = _get_triggers_for_action(server=args.server, action_identifier=identifier)
Expand All @@ -319,8 +281,7 @@ def control_objects(args: argparse.Namespace):
# around the full set of args everywhere to do so
for trigger in triggers:
yield request(
url=urljoin(args.server, "/api/events"),
data={"command": "publish", "event": trigger},
url=urljoin(args.server, "/api/events"), data={"command": "publish", "event": trigger},
)
else:
print(f"Unable to skip {identifier}.")
Expand Down Expand Up @@ -446,8 +407,7 @@ def main():
sys.exit(ExitCode.fail)
except RequestError as err:
print(
f"Error connecting to the tron server ({args.server}): {err}",
file=sys.stderr,
f"Error connecting to the tron server ({args.server}): {err}", file=sys.stderr,
)
sys.exit(ExitCode.fail)

Expand Down
41 changes: 9 additions & 32 deletions bin/trond
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def parse_cli():
parser = argparse.ArgumentParser()

parser.add_argument(
"--version",
action="version",
version=f"{parser.prog} {tron.__version__}",
"--version", action="version", version=f"{parser.prog} {tron.__version__}",
)

parser.add_argument(
Expand All @@ -38,22 +36,15 @@ def parse_cli():
)

parser.add_argument(
"-c",
"--config-path",
default=DEFAULT_CONF_PATH,
help="File path to the Tron configuration file",
"-c", "--config-path", default=DEFAULT_CONF_PATH, help="File path to the Tron configuration file",
)

parser.add_argument(
"--nodaemon",
action="store_true",
default=False,
help="[DEPRECATED] Disable daemonizing, default %(default)s",
"--nodaemon", action="store_true", default=False, help="[DEPRECATED] Disable daemonizing, default %(default)s",
)

parser.add_argument( # for backwards compatibility
"--pid-file",
help="[DEPRECATED] File path to pid file. Use --lock-file instead.",
"--pid-file", help="[DEPRECATED] File path to pid file. Use --lock-file instead.",
)

parser.add_argument(
Expand All @@ -64,23 +55,15 @@ def parse_cli():

logging_group = parser.add_argument_group("logging", "")
logging_group.add_argument(
"--log-conf",
"-l",
help="File path to a custom logging.conf",
"--log-conf", "-l", help="File path to a custom logging.conf",
)

logging_group.add_argument(
"-v",
"--verbose",
action="count",
default=0,
help="Verbose logging. Repeat for more verbosity.",
"-v", "--verbose", action="count", default=0, help="Verbose logging. Repeat for more verbosity.",
)

logging_group.add_argument(
"--debug",
action="store_true",
help="Debug mode, extra error reporting, no daemonizing",
"--debug", action="store_true", help="Debug mode, extra error reporting, no daemonizing",
)

api_group = parser.add_argument_group("Web Service API", "")
Expand All @@ -104,10 +87,7 @@ def parse_cli():
requirement = pkg_resources.Requirement.parse("tron")
api_group.add_argument(
"--web-path",
default=pkg_resources.resource_filename(
requirement,
"tronweb",
),
default=pkg_resources.resource_filename(requirement, "tronweb",),
help="Path to static web resources, default %(default)s.",
)

Expand All @@ -128,10 +108,7 @@ def parse_cli():
args.lock_file = DEFAULT_LOCKFILE

args.lock_file = os.path.join(args.working_dir, args.lock_file)
args.config_path = os.path.join(
args.working_dir,
args.config_path,
)
args.config_path = os.path.join(args.working_dir, args.config_path,)

return args

Expand Down
Loading