July 14th, 2024

Poor man's job runner with Clojure Agents

The article explores creating a job runner in Clojure using Agents for concurrency. It discusses motivation, implementation details, pros (no external libraries, error recovery) and cons (single process dependency, timing bugs).

Read original articleLink Icon
Poor man's job runner with Clojure Agents

This article discusses the creation of a job runner using Clojure Agents, exploring the misuse of Clojure's concurrency features to build an in-memory job runner. The author explains the motivation behind this project, highlighting the desire to utilize features beyond atoms and referencing Rich Hickey's "Ants" demo. By leveraging agents in Clojure, the author demonstrates how to manage background jobs with job control functionalities like run, pause, cancel, and observe job state without blocking execution. The article delves into the implementation details, including the use of validators and agents to ensure sequential execution and out-of-band job control. Pros of this approach include no need for external libraries, straightforward lock-free code, built-in error recovery, and observability of state and errors. However, potential cons involve the risk of in-memory job control being tied to a single process and the possibility of introducing subtle bugs related to timing and order. The author also mentions alternatives like using SQLite for job state management.

Related

My experience crafting an interpreter with Rust (2021)

My experience crafting an interpreter with Rust (2021)

Manuel Cerón details creating an interpreter with Rust, transitioning from Clojure. Leveraging Rust's safety features, he faced challenges with closures and classes, optimizing code for performance while balancing safety.

Llama-agents: an async-first framework for building production ready agents

Llama-agents: an async-first framework for building production ready agents

The GitHub repository `llama-agents` provides an async-first framework for multi-agent systems. It includes features like communication, tool execution, and human-in-the-loop functions. Detailed installation, workflows, examples, and API guidance are available.

Reasons to use your shell's job control

Reasons to use your shell's job control

Job control in a shell environment offers benefits like managing processes in foreground, background, or stopped states. Commands like fg, bg, Ctrl+z, and kill are explained for process manipulation. Users can kill unresponsive processes, background GUI apps, manage long-running jobs, test commands, and organize output efficiently.

Why Use Clojure for Machine Learning?

Why Use Clojure for Machine Learning?

Clojure's functional paradigm benefits machine learning with modular, readable, and predictable code. Leveraging JVM ensures speed and portability. Integration with Java libraries like TensorFlow and PyTorch supports deep learning. Despite being less mature, Clojure shows promise in ML projects.

Properly Testing Concurrent Data Structures

Properly Testing Concurrent Data Structures

The article explores testing concurrent data structures using the Rust library loom. It demonstrates creating property tests with managed threads to simulate concurrent behavior, emphasizing synchronization challenges and design considerations.

Link Icon 0 comments