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

add debug:scheduler command #49795

Merged
merged 1 commit into from
Mar 25, 2023
Merged

Conversation

kbond
Copy link
Member

@kbond kbond commented Mar 24, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets n/a
License MIT
Doc PR todo

Example output:

Scheduler
=========

default
-------

 ---------------------- ------------------- --------------------------- 
  Message                Trigger             Next Run                   
 ---------------------- ------------------- --------------------------- 
  stdClass               cron: 10 10 5 2 0   2024-02-04T10:10:00-05:00  
  generate user report   cron: 0 0 * * *     2023-03-25T00:00:00-04:00  
 ---------------------- ------------------- ---------------------------

The output is helped if the trigger and message implement \Stringable. I've made CronExpressionTrigger stringable but I think we should have all the packaged triggers implement.

@WebMamba
Copy link
Contributor

So fast! And you was even not there during the symfony live! 😁

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

Great addition for this new component.

Other debug commands support various output formats. You can add json, xml or md if you want, or just stick with txt and leave the other formats for later.

src/Symfony/Component/Scheduler/Command/DebugCommand.php Outdated Show resolved Hide resolved
@kbond
Copy link
Member Author

kbond commented Mar 25, 2023

Other debug commands support various output formats. You can add json, xml or md if you want, or just stick with txt and leave the other formats for later.

Interesting, I didn't know that. I modelled this command after debug:messenger which does not have this feature. I'd prefer that to be done in a followup PR.

@carsonbot carsonbot changed the title [Scheduler] add debug:scheduler command add debug:scheduler command Mar 25, 2023
@fabpot
Copy link
Member

fabpot commented Mar 25, 2023

Thank you @kbond.

@fabpot fabpot merged commit 50fbe01 into symfony:6.3 Mar 25, 2023
@kbond kbond deleted the debug-schedule-command branch March 25, 2023 11:56
fabpot added a commit that referenced this pull request Mar 29, 2023
This PR was squashed before being merged into the 6.3 branch.

Discussion
----------

[Scheduler] `debug:schedule` refinements

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Followup to #49795
| License       | MIT
| Doc PR        | n/a

Some fixes/refinements to the output:
1. If the message is an envelope, unwrap
2. prefix stringable message/trigger with short class name

```
 --------------------------- -------------------------------------- ---------------------------
  Message                     Trigger                                Next Run
 --------------------------- -------------------------------------- ---------------------------
  DoSomething: do something   CronExpressionTrigger: * * * * *       2023-03-25T08:03:00-04:00
 --------------------------- -------------------------------------- ---------------------------
```

Commits
-------

8396210 [Scheduler] `debug:schedule` refinements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants