Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# TaskMaster
The goal of this project is to make a job control daemon, with features similar to supervisor.

# Build steps
first go to the build directory
```
cd build
```

then you can build the project by running the following:
```
cmake ..
make
```

Executables will be located in the direcotries
```
./build/taskmasterd/taskmasterd
---------------------------------
./build/taskmasterctl/taskmaserctl
```

18 changes: 17 additions & 1 deletion taskmasterd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@ target_sources(taskmasterd PRIVATE ${SOURCES})
# include header directory
target_include_directories(taskmasterd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)

#include FetchContent module
include(FetchContent)

# Fetch yaml-cpp library
FetchContent_Declare(
yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
GIT_TAG 0.8.0
)
FetchContent_MakeAvailable(yaml-cpp)

# link yaml-cpp library
target_link_libraries(taskmasterd PUBLIC yaml-cpp)

# Set C++ standard to C++20
set_target_properties(taskmasterd PRIVATE cxx_std_20)
set_target_properties(taskmasterd PROPERTIES CXX_STANDARD 20)



# the PRIVATE keyword means that the target source and include directories will
# only be used for this target and not for any targets that link to it.
Empty file removed taskmasterd/include/example.hpp
Empty file.
17 changes: 17 additions & 0 deletions taskmasterd/include/job.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <string>
#include <vector>

class Job {
public:
Job(const std::string& name);
void execute();

private:
// The name of the job
std::string _name;

// Process ID of the job
std::vector<pid_t> _pid;
};
8 changes: 8 additions & 0 deletions taskmasterd/src/job.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "job.hpp"
#include <iostream>

Job::Job(const std::string& name) : _name(name) {}

void Job::execute() {
std::cout << "Executing job: " << _name << std::endl;
}
16 changes: 13 additions & 3 deletions taskmasterd/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#include <iostream>
#include <yaml-cpp/yaml.h>
#include "job.hpp"

int main() {
int i = 0 ;
return 0;
Job job("Example Job");
std::cout << "Hello, Taskmaster!" << std::endl;

// Load configuration from YAML file
YAML::Node config = YAML::LoadFile("../config.yaml");

job.execute();
return 0;

i++;
}