/happy_friday

Build an optimal schedule for a distributed development team for this Friday.

Primary LanguageRubyMIT LicenseMIT

main Actions Status  Coverage

Happy Friday

Build an optimal schedule for a distributed development team for this Friday.

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Testing
  5. Code Nagivation
  6. Contact

About The Project

Happy Friday Project Requirements

Built With

The algorithm for scheduling job is primarily based on Branch and Bound algorithm which is addressed in this Job Assignment Problem Using Branch and Bound article.

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Ruby 2.7
Bundler 2.2

Installation

  1. Clone the repo
    git clone git@github.com:buithehoa/happy_friday.git
  2. Install dependencies
    bundle install

Usage

From the root folder of the project, execute ./bin/schedule with parameters as follows

./bin/schedule <performance_csv_path> <tasks_csv_path> <teams_csv_path> <output_path>

Here's an example using existing CSV files included in the project. When option -v is provided, the content of the exported CSV will be printed out.

./bin/schedule -v ./spec/fixtures/files/sample_input/performance.csv spec/fixtures/files/sample_input/tasks.csv spec/fixtures/files/sample_input/teams.csv /tmp

The output will be similar to the following

+--------+-----------------------------+-----------------------------+---------+
| Team   | Local Time                  | UTC Time                    | Task No |
| Moscow | Fri 09:00 AM - Fri 01:00 PM | Fri 06:00 AM - Fri 10:00 AM | 1       |
| Moscow | Fri 01:00 PM - Fri 07:00 PM | Fri 10:00 AM - Fri 04:00 PM | 4       |
| London | Fri 09:00 AM - Fri 02:00 PM | Fri 09:00 AM - Fri 02:00 PM | 2       |
| London | Fri 02:00 PM - Fri 06:00 PM | Fri 02:00 PM - Fri 06:00 PM | 3       |
+--------+-----------------------------+-----------------------------+---------+
Exported file path: /tmp/schedule-20210915-104856.csv

The content of /tmp/schedule-20210915-104856.csv will be as follows

Team,Local Time,UTC Time,Task No
Moscow,09:00 AM - 01:00 PM,06:00 AM - 10:00 AM,1
Moscow,10:00 AM - 04:00 PM,10:00 AM - 04:00 PM,4
London,09:00 AM - 02:00 PM,09:00 AM - 02:00 PM,2
London,02:00 PM - 06:00 PM,02:00 PM - 06:00 PM,3

Testing

To run all specs, execute rspec

$ bundle exec rspec
Finished in 1.13 seconds (files took 0.14603 seconds to load)
24 examples, 0 failures

Code Navigation

  1. The entry point of the program is Main#run which is called in bin/schedule as follows
Main.new(*ARGV).run
  1. The scheduling algorithm is implemented in Scheduler::BranchAndBound and 2 supporting models: Scheduler::Node and Scheduler::Workload which can be found under lib/scheduler. The algorithm is triggered as follows in Main
schedule = Scheduler::BranchAndBound.new(
  workload.estimated_effort,
  workload.timezone_offsets).run
  1. The functionality of CSVHandler class includes
  • Read input CSV files to collect input data
  • Export calculated schedule to CSV files

Contact

Bui The Hoa - @buithehoa

Project Link: https://github.com/buithehoa/happy_friday