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

Scheduler #180

Closed
NickBrecht opened this issue Feb 6, 2019 · 27 comments
Closed

Scheduler #180

NickBrecht opened this issue Feb 6, 2019 · 27 comments

Comments

@NickBrecht
Copy link

From what I can tell, this is near the perfect solution for script interfacing for nontechnical users.

The ability to schedule scripts is the only feature I feel is missing. Ideally, being able to assign specific dates, times, and/or cadences would round out this as a solution.

Sorry if this is already feature, but no mention of it in the wiki/docs.

@bugy
Copy link
Owner

bugy commented Feb 6, 2019

Hi Nick, thanks for the feedback and the proposal.

From the usecases I had on my work, as a developer, all the script runs were one time job, and they were dependant on parameters. That's why I didn't put much effort on tasks automation.
Also there are a lot of other great tools for automation.

However I see, that Script server is getting more popular and new usecases appear. So adding a scheduler would make sense. Could you please share, what kind of scripts you imagine could be run on a reccurring basis?
I believe they won't be parameterized in this case.
And who would run them, non-technical users or admins/devops?

@bugy bugy added the feature label Feb 6, 2019
@NickBrecht
Copy link
Author

Thanks for the quick reply.

I'm actually an analyst and I've fallen into a somewhat devops type of role.

For example, I have several scripts that pull data from several databases/APIs, provide some light cleaning/formatting, and kick out a report to a networked drive. I have this scheduled to run via windows task scheduler, but it would be amazing to manage this through one portal. Additionally, giving more non-technical users the option to kick off a report themselves would be optimal if the need should arise.

Another usecase for a nontechnical user would be something that I've also provided some of my team some packaged scripts that do simple things like "import excel file, format data, upload data through website API". These will be less parameter based and more just a way to deliver quick tools to users without worrying about dependencies and updates.

If there is a better solution out there for a centralized script server that is at all friendly to nontechnical users, let me know. So far, this is the best option I've run across that isn't cronjobs.

In conjunction with the scheduler, it may be beneficial to include some sort of "job queue" to see the running and queued scripts.

@yosefy
Copy link

yosefy commented Feb 6, 2019 via email

@bugy
Copy link
Owner

bugy commented Feb 6, 2019

Hi Nick, thanks for very detailed description!

As far as I understood you consider using scheduler without any parameters and only for yourself. And other users will on demand execute one-time jobs (may be with parameters). Or I understood your idea wrong?

Regarding other tools, I would recommend you to check Rundeck. It has more features and definitely has advanced support for job scheduling (and reports). Though as for me for users it's a little bit more complicated

In any case I would like to keep this feature in the backlog, but cannot promise a fast solution for it.

@cicdteam
Copy link

cicdteam commented Feb 7, 2019

Guys, seems you are talking about standard (in unix/linux env) crontab. Main purpose (as I think) of script-server - give simple but usable UI to run scripts (manually) and see their result.

@Pmoshbr
Copy link

Pmoshbr commented Oct 2, 2019

I use this other webgui ( https://github.com/asher/chronos-python ), just because the schedule feature. But Script-Server is much better, and I will love to migrate if you guys add this feature... Check this other repo for ideas..!! thks

@bugy
Copy link
Owner

bugy commented Oct 13, 2019

Hi @Pmoshbr, could you explain your use case please?
Who is supposed to start/configure cron jobs? Will it be you (admin) or other users?
Can these jobs be parameterized?
Can one user schedule multiple instances of the same job (with different parameters, for example)?
Can multiple users schedule multiple instances of the same job?

@Pmoshbr
Copy link

Pmoshbr commented Oct 14, 2019

Hi @Pmoshbr, could you explain your use case please?
Who is supposed to start/configure cron jobs? Will it be you (admin) or other users?
Can these jobs be parameterized?
Can one user schedule multiple instances of the same job (with different parameters, for example)?
Can multiple users schedule multiple instances of the same job?

Hi @bugy, thanks for the reply...

  • My use is very simple, I'm the only user from the system (admin), and all scripts are scheduled by me.
  • I never used any parameter in my scripts, but if this could be possible will be a very good plus..
  • My script's are "run once" and just one instance, they don't keep running at backgroud, simple do what have to do and exit.
  • The log from script is writen in a separete file at local dir with date and time name. I use another script to keep only 15days logs files saved, and run once every day a clean.

Basically my script's do database processing, files arrage, and reports... very simple...

@bugy
Copy link
Owner

bugy commented Oct 14, 2019

Hi @Pmoshbr, thanks for the nice description. Unfortunately, I have to admit, that this use case is almost 100% different from what script server is (you don't need web UI for scheduling scripts).
I'm working

It's still a nice feature and I'll add it in the future, but I would prefer to get more votes for it :)

@cinguva
Copy link

cinguva commented Nov 3, 2019

Hey @bugy This is what i was requesting, able to schedule some scripts to run repeatedly with option to run on periodic basis with one time set up and able to change the schedule.

@muzzol
Copy link

muzzol commented Nov 3, 2019

sorry to jump in.
I think what @bugy is trying to say is that you already got cron and other tools to perform that, so it's not a priority.

@cinguva
Copy link

cinguva commented Nov 4, 2019

I agree with prioritizing this request based on votes, but i was still wondering, if this can be included in backlog as executing scripts from UI is what we love and we use script server for, executing scripts also involves automation and scheduling, script server will be more powerful if we can embed scheduling feature to it. Just thinking out loud.

@bugy
Copy link
Owner

bugy commented Nov 4, 2019

Hi @cinguva, to better understand the use case and how to implement it in generic way, could you answer those questions please?
Who is supposed to start/configure cron jobs? Will it be you (admin) or other users?
Can these jobs be parameterized?
Can one user schedule multiple instances of the same job (with different parameters, for example)?
Can multiple users schedule multiple instances of the same job?

@kilburn
Copy link

kilburn commented Jan 15, 2020

I've been using script-server for a while to allow "normal users" to run several tasks. Now I'm in a situation where users are asking me to be able to schedule task executions.

Who is supposed to start/configure cron jobs? Will it be you (admin) or other users?

The users themselves

Can these jobs be parameterized?

Yes, just like normal scripts.

Can one user schedule multiple instances of the same job (with different parameters, for example)?

Yes.

Can multiple users schedule multiple instances of the same job?

Yes

Use-case description

  1. The user opens a script page
  2. The user fills in the script's parameters
  3. The user presses a new "schedule" button that's right next to the "execute" button.
  4. The website shows a modal/collapsible panel with fields to select when to run script
  5. The user fills in the time at which to run
  6. The user presses the "ok" button (or something similar)
  7. Script-server will launch the script with the provided parameters at the defined time.

Of course, this would also mean that there should be a similar page to the "logs" one where users can view the scheduled tasks.

@bugy
Copy link
Owner

bugy commented Jan 15, 2020

Hi @kilburn, thanks for the nice description!
One question: in your use case, were you talking about repeating tasks (e.g. every day at the same time) or scheduling an execution for a single time?

@kilburn
Copy link

kilburn commented Jan 15, 2020

were you talking about repeating tasks (e.g. every day at the same time) or scheduling an execution for a single time?

My current use-case is single-time execution, so I would be happy with just that.

Nonetheless it doesn't seem like a huge leap to go from single-time to execution at programmed times once the former is implemented.

@Pmoshbr
Copy link

Pmoshbr commented Jan 15, 2020 via email

@bugy bugy added this to the 1.16.0 milestone Apr 3, 2020
@bugy bugy removed the voting label Apr 3, 2020
bugy added a commit that referenced this issue Jul 26, 2020
@bugy
Copy link
Owner

bugy commented Jul 26, 2020

Good news everyone, the first version of scheduler is there :)

There is an additional button near "Start" and "Stop".
image

The feature should be explicitly enabled per script, using the following config (in a script json file):

  "scheduling": {
    "enabled": true
  }

It supports one time and repetitive execution.
Scheduled jobs are stored under conf/schedules, so it's fine to restart script server.

Limitations:

  • If Script server is down, scripts scheduled for that time period won't be executed (even after you start the server)
  • If a script has "secure" parameter, it cannot be scheduled
  • There is no possibility to distinguish normal execution from scheduled executions (this is a feature for the future)
  • If you put your PC to hibernation, nothing will be executed. But if something was supposed to be executed during hibernation, it will be executed after resuming PC (this is different from PC being completely shut down)

If anyone can enable and test this feature, I would greatly appreciate it! And any feedback

@bugy bugy added the resolved label Jul 26, 2020
@Pmoshbr
Copy link

Pmoshbr commented Jul 27, 2020

Good news everyone, the first version of scheduler is there :)

There is an additional button near "Start" and "Stop".
image

The feature should be explicitly enabled per script, using the following config (in a script json file):

  "scheduling": {
    "enabled": true
  }

It supports one time and repetitive execution.
Scheduled jobs are stored under conf/schedules, so it's fine to restart script server.

Limitations:

  • If Script server is down, scripts scheduled for that time period won't be executed (even after you start the server)
  • If a script has "secure" parameter, it cannot be scheduled
  • There is no possibility to distinguish normal execution from scheduled executions (this is a feature for the future)
  • If you put your PC to hibernation, nothing will be executed. But if something was supposed to be executed during hibernation, it will be executed after resuming PC (this is different from PC being completely shut down)

If anyone can enable and test this feature, I would greatly appreciate it! And any feedback

Owww! Great news! How can I test this new feature? I have do install from master or a especific release?
At my server I'm running the docker version, the lastest release I checked and is not updated since 6 months ago... And de dev release 20h ago... Should I test with dev version?

Just adding the config json will enable the scheduler at script?

Thanks for adding this feature! this will help a lot my work!

@bugy
Copy link
Owner

bugy commented Jul 27, 2020

Hi @Pmoshbr yes, you need to use dev version
And for enabling the feature, you need to modify corresponding script json files (for each script) by adding the snippet, I provided above

@antonellocaroli
Copy link

It's not a function I'm particularly interested in.

But I've tried it... but I don't understand how it works...

How can I tell if he executed the script?

in History I can't find anything....

@antonellocaroli
Copy link

antonellocaroli commented Jul 27, 2020

Ok, it was my problem with the system date...

how do you erase a schedule?

Where is the programming saved? In which file?

@bugy
Copy link
Owner

bugy commented Jul 27, 2020 via email

@antonellocaroli
Copy link

ok, The important thing is to know where he saved them, then it's easy to solve...

image

@bugy
Copy link
Owner

bugy commented Jul 29, 2020

Hehe, nice :)

antonellocaroli pushed a commit to antonellocaroli/script-server that referenced this issue Aug 1, 2020
@tristanlatr
Copy link

Hello, thanks for this feature

Is there an specific reason why

"scheduling": {
    "enabled": true
  }

has to be written in config files directly and not supported by the UI ?

Thanks

@bugy
Copy link
Owner

bugy commented Sep 15, 2020 via email

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

No branches or pull requests

10 participants