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

Implement a run-schedule command #259

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Implement a run-schedule command #259

merged 1 commit into from
Feb 21, 2024

Conversation

creativeprojects
Copy link
Owner

@creativeprojects creativeprojects commented Sep 25, 2023

Before finishing the new schedule section for the configuration v2, the existing scheduling could benefit from a new run-schedule command.

This will simplify the command line generated by the scheduler, and avoid re-scheduling when changing the configuration in most cases.

Implementation details:

  • Moving config.ScheduleConfig to schedule.Config
  • Creating a Schedule object between the configuration file and the schedule.Config object

Progress:

  • Implementation
  • Tests
  • Documentation
  • Ready for review

@creativeprojects creativeprojects changed the title Implement a un-rschedule command Implement a run-schedule command Sep 25, 2023
@creativeprojects creativeprojects added this to the v0.24.0 milestone Sep 25, 2023
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Attention: 91 lines in your changes are missing coverage. Please review.

Comparison is base (e93874d) 68.68% compared to head (e84045e) 69.85%.

Files Patch % Lines
commands.go 69.62% 24 Missing ⚠️
schedule/handler_windows.go 14.29% 12 Missing ⚠️
schtasks/taskscheduler.go 15.38% 11 Missing ⚠️
schedule/handler_systemd.go 25.00% 9 Missing ⚠️
schedule/mocks/Handler.go 46.67% 7 Missing and 1 partial ⚠️
schedule/handler_crond.go 0.00% 7 Missing ⚠️
config/schedule.go 86.49% 5 Missing ⚠️
schedule/config.go 85.71% 4 Missing ⚠️
schedule/handler_darwin.go 55.56% 4 Missing ⚠️
context.go 94.44% 1 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #259      +/-   ##
==========================================
+ Coverage   68.68%   69.85%   +1.16%     
==========================================
  Files         117      118       +1     
  Lines       11779    11889     +110     
==========================================
+ Hits         8090     8304     +214     
+ Misses       3305     3195     -110     
- Partials      384      390       +6     
Flag Coverage Δ
unittests 69.85% <71.91%> (+1.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@creativeprojects creativeprojects marked this pull request as draft September 25, 2023 18:55
@jkellerer
Copy link
Collaborator

That's great. Had thought as well that such a change would make sense 👍

@creativeprojects creativeprojects modified the milestones: v0.24.0, v0.25.0 Oct 24, 2023
@creativeprojects creativeprojects force-pushed the run-schedule branch 2 times, most recently from c18b15c to 415f907 Compare October 29, 2023 20:26
@creativeprojects
Copy link
Owner Author

The same problem I had with schedule-v2 PR arises here again 😞 there's too many changes to introduce in one PR.
That makes it difficult to review.

I'm going to try to split it up nicely again 👍🏻

@creativeprojects
Copy link
Owner Author

I think it's the 3rd or maybe 4th time I'm refactoring the scheduling layer, it seems like I always manage to make a mess of it 🤣

The idea on this refactoring is to use an intermediary struct config.Schedule to be used by both the v1 and v2 scheduling configuration.

Anyway I think I just need to add a bit of documentation now 👍🏻

Copy link
Collaborator

@jkellerer jkellerer left a comment

Choose a reason for hiding this comment

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

In general it looks good. I have added a few feedbacks and one concern regarding breaking existing v2 configs. I have not yet tried to use it though.

config/profile.go Show resolved Hide resolved
config/schedule.go Outdated Show resolved Hide resolved
config/schedule.go Outdated Show resolved Hide resolved
commands.go Outdated Show resolved Hide resolved
commit 62fc47e
Author: Fred <fred@creativeprojects.tech>
Date:   Wed Feb 21 10:10:53 2024 +0000

    avoid the file to be checked by the json schema validator

commit 911b6d2
Author: Fred <fred@creativeprojects.tech>
Date:   Wed Feb 21 09:57:13 2024 +0000

    commit updated mock

commit 6062a7c
Author: Fred <fred@creativeprojects.tech>
Date:   Wed Feb 21 09:46:58 2024 +0000

    Squashed commit of the following:

    commit f461ef9
    Author: Fred <fred@creativeprojects.tech>
    Date:   Tue Feb 13 21:22:30 2024 +0000

        WIP

    commit 12ede06
    Author: Fred <fred@creativeprojects.tech>
    Date:   Sat Feb 10 11:00:07 2024 +0000

        create Init method

    commit d72db8a
    Author: Fred <fred@creativeprojects.tech>
    Date:   Sat Feb 10 10:10:27 2024 +0000

        Squashed commit of the following:

        commit 31729b5
        Author: Fred <fred@creativeprojects.tech>
        Date:   Sat Feb 10 10:07:30 2024 +0000

            allow run-schedule command on v2 format

        commit bffa06d
        Author: Fred <fred@creativeprojects.tech>
        Date:   Wed Feb 7 21:50:03 2024 +0000

            merge ProfileName and Profiles into one Profiles field

        commit ec09efd
        Author: Fred <fred@creativeprojects.tech>
        Date:   Wed Feb 7 21:05:33 2024 +0000

            Squashed commit of the following:

            commit 24a6d6d
            Author: Fred <fred@creativeprojects.tech>
            Date:   Tue Nov 14 16:51:50 2023 +0000

                fix: remove schedule name from arguments

            commit ffee984
            Author: Fred <fred@creativeprojects.tech>
            Date:   Tue Nov 14 15:37:48 2023 +0000

                fix: add noshow tag to hide schedule options
                from main section

            commit e840956
            Author: Fred <fred@creativeprojects.tech>
            Date:   Sun Nov 12 18:06:50 2023 +0000

                docs: add information on run-schedule command

            commit 4e4bebb
            Author: Fred <fred@creativeprojects.tech>
            Date:   Sun Nov 12 17:15:33 2023 +0000

                extract context creation for unit tests

            commit c7775a4
            Author: Fred <fred@creativeprojects.tech>
            Date:   Sun Nov 12 12:56:42 2023 +0000

                wire up ignore-on-battery and locks
                from schedule configuration to context

            commit 329696e
            Author: Fred <Fred@CreativeProjects.Tech>
            Date:   Sat Nov 11 20:14:29 2023 +0000

                update crond to support new run-schedule command line

            commit 78a9c7d
            Author: Fred <fred@creativeprojects.tech>
            Date:   Sat Nov 11 19:34:49 2023 +0000

                Squashed commit of the following:

                commit 97086b8
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sat Nov 11 18:00:29 2023 +0000

                    add a default log file on darwin

                commit ef2469a
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sat Nov 11 15:57:13 2023 +0000

                    Merge from pass-context-struct

                commit f650dd4
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sat Nov 11 15:43:17 2023 +0000

                    return a new context on each `With` method

                commit 1157e07
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sun Nov 5 19:07:33 2023 +0000

                    add tests

                commit a3f4919
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sun Nov 5 18:42:50 2023 +0000

                    move logTarget to context

                commit c8b4421
                Author: Fred <fred@creativeprojects.tech>
                Date:   Sun Nov 5 17:26:24 2023 +0000

                    refactoring Context struct

                commit 4144642
                Author: Fred <fred@creativeprojects.tech>
                Date:   Wed Nov 1 17:15:46 2023 +0000

                    pass context to own commands and profile runnner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants