Gowl is a process management and process monitoring tool at once. An infinite worker pool gives you the ability to control the pool and processes and monitor their status.

Gowl

Build Status codecov Go Report Card FOSSA Status Mentioned in Awesome Go Go Reference

Gowl is a process management and process monitoring tool at once. An infinite worker pool gives you the ability to control the pool and processes and monitor their status.

Table of Contents

Install

Using Gowl is easy. First, use go get to install the latest version of the library. This command will install the gowl along with library and its dependencies:

go get -u github.com/hamed-yousefi/gowl

Next, include Gowl in your application:

import "github.com/hamed-yousefi/gowl"

How to use

Gowl has three main parts. Process, Pool, and Monitor. The process is the smallest part of this project. The process is the part of code that the developer must implement. To do that, Gowl provides an interface to inject outside code into the pool. The process interface is as follows:

Process interface {
Start() error
Name() string
PID() PID
}

The process interface has three methods. The Start function contains the user codes, and the pool workers use this function to run the process. The Name function returns the process name, and the monitor uses this function to provide reports. The PID function returns process id. The process id is unique in the entire pool, and it will use by the pool and monitor.

Let's take a look at an example:

Document struct {
content string
hash string
}

func (d *Document) Start() error {
hasher := sha1.New()
hasher.Write(bv)
h.hash = base64.URLEncoding.EncodeToString(hasher.Sum(nil))
}

func (d *Document) Name() string {
return "hashing-process"
}

func (d *Document) PID() PID {
return "p-1"
}

func (d *Document) Hash() string {
return h.hash
}

As you can see, in this example, Document implements the Process interface. So now we can register it into the pool.

Pool

Creating Gowl pool is very easy. You must use the NewPool(size int) function and pass the pool size to this function. Pool size indicates the worker numbers in and the underlying queue size that workers consume process from it. Look at the following example:

pool := gowl.NewPool(4)

In this example, Gowl will create a new instance of a Pool object with four workers and an underlying queue with the size of four.

Start

To start the Gowl, you must call the Start() method of the pool object. It will begin to create the workers, and workers start listening to the queue to consume process.

Register process

To register processes to the pool, you must use the Register(args ...process) method. Pass the processes to the register method, and it will create a new publisher to publish the process list to the queue. You can call multiple times when Gowl pool is running.

Kill process

One of the most remarkable features of Gowl is the ability to control the process after registered it into the pool. You can kill a process before any worker runs it. Killing a process is simple, and you need the process id to do it.

pool.Kill(PID("p-909"))

Close

Gowl is an infinite worker pool. However, you should have control over the pool and decide when you want to start it, register a new process on it, kill a process, and close the pool and terminate the workers. Gowl gives you this option to close the pool by the Close() method of the Pool object.

Monitor

Every process management tool needs a monitoring system to expose the internal stats to the outside world. Gowl gives you a monitoring API to see processes and workers stats.

You can get the Monitor instance by calling the Monitor() method of the Pool. The monitor object is as follows:

Monitor interface {
PoolStatus() pool.Status
Error(PID) error
WorkerList() []WorkerName
WorkerStatus(name WorkerName) worker.Status
ProcessStats(pid PID) ProcessStats
}

The Monitor gives you this opportunity to get the Pool status, process error, worker list, worker status, and process stats. Wis Monitor API, you can create your monitoring app with ease. The following example is using Monitor API to present the stats in the console in real-time.

process-monitoring

Also, you can use the Monitor API to show worker status in the console:

worker-monitoring

License

MIT License, please see LICENSE for details.

Similar Resources

Distributed simple and robust release management and monitoring system.

Distributed simple and robust release management and monitoring system.

Agente Distributed simple and robust release management and monitoring system. **This project on going work. Road map Core system First worker agent M

Nov 17, 2022

Cloudinsight Agent is a system tool that monitors system processes and services, and sends information back to your Cloudinsight account.

Cloudinsight Agent 中文版 README Cloudinsight Agent is written in Go for collecting metrics from the system it's running on, or from other services, and

Nov 3, 2022

A tool to list and diagnose Go processes currently running on your system

gops gops is a command to list and diagnose Go processes currently running on your system. $ gops 983 980 uplink-soecks go1.9 /usr/local/bin/u

Dec 27, 2022

Peimports - based on golang's debug/pe this package gives quick access to the ordered imports of pe files with ordinal support

This code is almost entirely derived from the Go standard library's debug/pe package. It didn't provide access to ordinal based entries in the IAT and

Jan 5, 2022

ProfileStatusSyncer - A tool to synchronize user profile status of Github and Netease CloudMusic

ProfileStatusSyncer A tool to synchronize user profile status of GitHub and Nete

Jul 20, 2022

Hidra is a tool to monitor all of your services without making a mess.

hidra Don't lose your mind monitoring your services. Hidra lends you its head. ICMP If you want to use ICMP scenario, you should activate on your syst

Nov 8, 2022

A system and resource monitoring tool written in Golang!

A system and resource monitoring tool written in Golang!

Grofer A clean and modern system and resource monitor written purely in golang using termui and gopsutil! Currently compatible with Linux only. Curren

Jan 8, 2023

checkah is an agentless SSH system monitoring and alerting tool.

CHECKAH checkah is an agentless SSH system monitoring and alerting tool. Features: agentless check over SSH (password, keyfile, agent) config file bas

Oct 14, 2022
Comments
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

  • [IMP] Add context to the tasks so they can be cacelled.

    [IMP] Add context to the tasks so they can be cacelled.

    This PR adds context to the tasks so when they are started can be cancelled (if they consider the context cancellation), before this PR the task can be killed only if they haven't started.

    Also some minor typos.

    These changes brake the api, but can easily fixed just adding the context parameter.

  • Process cancellation

    Process cancellation

    Hi,

    Having the cacellation feature is great, but only works if the task isn't started. I think if we pass the context to the start method (and it behaves as expected) the process itself can be cancelled too.

    I know this chance brakes the API, but can be useful in future versions, what do you think @hamed-yousefi ?

    Regards.

System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.
System resource usage profiler tool which regularly takes snapshots of the memory and CPU load of one or more running processes so as to dynamically build up a profile of their usage of system resources.

Vegeta is a system resource usage tracking tool built to regularly take snapshots of the memory and CPU load of one or more running processes, so as to dynamically build up a profile of their usage of system resources.

Jan 16, 2022
A GNU/Linux monitoring and profiling tool focused on single processes.
A GNU/Linux monitoring and profiling tool focused on single processes.

Uroboros is a GNU/Linux monitoring tool focused on single processes. While utilities like top, ps and htop provide great overall details, they often l

Dec 26, 2022
Monitoring-go - A simple monitoring tool to sites of MOVA

Monitoring GO A simple monitoring tool to sites of MOVA How to use Clone Repo gi

Feb 14, 2022
Go web monitor - A web monitor with golang

Step Download “go installer” and install on your machine. Open VPN. Go to “web-m

Jan 6, 2022
SigNoz helps developer monitor applications and troubleshoot problems in their deployed applications
SigNoz helps developer monitor applications and troubleshoot problems in their deployed applications

SigNoz helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc. ?? ??

Dec 27, 2022
Cloudprober is a monitoring software that makes it super-easy to monitor availability and performance of various components of your system.

Cloudprober is a monitoring software that makes it super-easy to monitor availability and performance of various components of your system. Cloudprobe

Dec 30, 2022
Pixie gives you instant visibility by giving access to metrics, events, traces and logs without changing code.
Pixie gives you instant visibility by giving access to metrics, events, traces and logs without changing code.

Pixie gives you instant visibility by giving access to metrics, events, traces and logs without changing code.

Jan 4, 2023
Monitor the performance of your Ethereum 2.0 staking pool.

eth-pools-metrics Monitor the performance of your Ethereum 2.0 staking pool. Just input the withdrawal credentials that were used in the deposit contr

Dec 30, 2022
Monitor a process and trigger a notification.
Monitor a process and trigger a notification.

noti Monitor a process and trigger a notification. Never sit and wait for some long-running process to finish. Noti can alert you when it's done. You

Jan 3, 2023
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go

Package monkit is a flexible code instrumenting and data collection library. See documentation at https://godoc.org/gopkg.in/spacemonkeygo/monkit.v3 S

Dec 14, 2022