dagu icon indicating copy to clipboard operation
dagu copied to clipboard

can I extend dagu and use in my company?

Open kimkit opened this issue 2 years ago • 5 comments
trafficstars

I want to add some internal executors

kimkit avatar Apr 19 '23 06:04 kimkit

Hi @kimkit, I think your idea sounds really interesting! I'd love to hear more about it. Can you let me know what kind of executor you need? If you're looking for an internal executor, you may need to build the code yourself for now.

Could you please provide more information of the executors that you would like to create? We can consider to use Starlark language to allow users to implement their original executor. Please let us know your thoughts on it.

yottahmd avatar Apr 19 '23 11:04 yottahmd

@yohamta sorry for the delay. dagu put all packages in internal directory, so I can't create new binary based on this repo. We have one cron service written by golang which pull scripts (lua, run with gopher-lua) from data center (eg: consul) and run these scripts scheduled (use github.com/robfig/cron/v3). I want to extend dagu to execute scripts directly.

kimkit avatar Apr 26 '23 05:04 kimkit

Hi @kimkit , I was thinking that you might be able to call the binary in a workflow like this:

steps:
  - name: run-script
    command: lua-runner
    script: |
      <...lua script...>

If you need to pull the script from a data source, the http executor could be helpful:

steps:
  - name: read-script
    command: GET http://get/some/script
    executor:
      type: http
      headers:
        Authorization: "Bearer $TOKEN"
      config:
        silent: true
    output: SCRIPT

  - name: run-script
    command: lua-runner
    script: $SCRIPT

Is the reason you want to extend the executor to avoid repetition in writing this kind of script? If that's the case, we're working on implementing user-defined functions to tackle repetitive definitions: #429 What are your thoughts on this?

yottahmd avatar Apr 26 '23 14:04 yottahmd

user-defined functions is a good idea. thanks.

kimkit avatar Apr 27 '23 06:04 kimkit

Great to hear that. Thanks.

yottahmd avatar Apr 27 '23 10:04 yottahmd