Skip to content

Support relaying a datetime to start commands from tronctl#1104

Open
jfongatyelp wants to merge 1 commit into
masterfrom
jfong/parse_date_to_datetime
Open

Support relaying a datetime to start commands from tronctl#1104
jfongatyelp wants to merge 1 commit into
masterfrom
jfong/parse_date_to_datetime

Conversation

@jfongatyelp

Copy link
Copy Markdown
Contributor

Today, tronctl start and tronctl backfill commands accept date-only parameters because they use the parse_date helper which only knows the %Y-%m-%d format.

However, this meant t hat we would never be able to initiate a run with a custom start time, e.g. to backfill a sub-daily (eg hourly) job.

The start support in the api, however, doesn't seem to reduce the run_time param to just a date:
resource.py's render_POST -> requestarg's get_datetime -> DATE_FORMAT which includes time ("%Y-%m-%d %H:%M:%S")

This PR expands the supported formats in parse_date to some common datetime formats. I also took the opportunity to move it to our shared cmd_utils rather than leaving it just in tronctl itself, and added some dumb tests.

This change won't help tronctl backfill generate more than daily schedules, but at least allows folks to work around that limitation and send their own datetime thru tronctl start.

@jfongatyelp
jfongatyelp requested a review from a team as a code owner July 9, 2026 00:19
@KaspariK

Copy link
Copy Markdown
Member

I think one catch, that's probably not a big deal, is backfill will also use this expanded date parser, right? So we'll accept datetimes but the command will stay date-based (like, timestamps are stripped in dryrun output, but real runs still submit the full datetime to the API).

Not saying anyone would do this but this would generate 1 run:
tronctl backfill job --start-date 2026-07-08T18:00 --end-date 2026-07-09

And this would generate 2:
tronctl backfill job --start-date 2026-07-08 --end-date 2026-07-09

@jfongatyelp

jfongatyelp commented Jul 10, 2026 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants