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

Build a Job class #37

Open
terraboops opened this issue Jan 6, 2017 · 5 comments
Open

Build a Job class #37

terraboops opened this issue Jan 6, 2017 · 5 comments

Comments

@terraboops
Copy link

Currently, jobs are a ruby file that invoke Rufus scheduler directly and then call send_event. It would be much better for many reasons if there was a superclass which users could subclass. The subclass would be responsible for providing the implementation for a 'run' method which would return a value to the caller.

Benefits:

  • Abstracts the use of Rufus, making it easier to update or replace it in the future
  • Enhanced testability of Job logic -- simply mock job dependencies and assert the output
  • Less confusion for beginners about what is happening when (dashboard start time vs. job runtime)
@kinow
Copy link
Member

kinow commented Jan 6, 2017

Good idea. I like specially abstraction. I have a pattern that I use with YAML files and some boilerplate code for encryption (simple base64 by default, but with support to Amazon KMS too). When vacation is over (February hooray! 🎉 ) I will file an issue for that. But having a Job class could be useful for that too, so my +1

@vStone
Copy link
Contributor

vStone commented Jan 12, 2017

Maybe try to add loading and passing through settings in a unified way too. This way we might prevent a lot of copy pastes and hardcoded configuration in the jobs, making them less re-useable

@kinow
Copy link
Member

kinow commented Jan 12, 2017

@vStone the way I'm configuring my jobs now is with a dashboard.yml file or similar in the top level. e.g. (writing without testing the syntax):

- bitbucket:
  - repositories:
    - a
    - b
  - credentials:
    - username: abc
    - password: abc
- testlink:
    - credentials:
      - username: abc

I will have access to the working dashboard in one week and will update the ticket with the complete set up. But basically, each job imports an utility class (that could be part of smashing core if others find it useful) and this class has the methods to parse the YAML.

@JoshuaEdwards1991
Copy link

can you use the dashing jobs generator with smashing?

@suhussai
Copy link

suhussai commented Feb 1, 2017

@JoshuaEdwards1991 what do you mean by using the dashing jobs generator with smashing?

At this point, Dashing and Smashing are quite similar so you should be able to generate jobs using Smashing, just as you would in Dashing.

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

No branches or pull requests

5 participants