Skip to content

cloudant-labs/clouseau

Folders and files

NameName
Last commit message
Last commit date

Latest commit

dc6845c · Mar 6, 2025
Mar 6, 2025
Apr 17, 2024
Mar 16, 2022
Mar 6, 2025
Nov 8, 2024
Jan 2, 2025
Feb 13, 2025
Jul 15, 2024
Jan 2, 2025
Dec 20, 2024
Nov 21, 2024
Mar 6, 2025
Oct 24, 2024
Sep 20, 2024
Dec 17, 2024
Nov 1, 2024
Nov 1, 2024
Feb 14, 2025
Nov 4, 2024
Mar 16, 2022
Mar 6, 2025
Feb 13, 2025
Dec 20, 2024
Mar 6, 2025
Jul 18, 2024
Nov 5, 2024
Mar 6, 2025
Oct 7, 2024
Jul 24, 2024
Apr 9, 2024
Nov 8, 2024
Feb 14, 2025
Nov 26, 2024

Repository files navigation

ziose

The ziose project is an attempt to replace foundation of clouseau with a ZIO as an asynchronous scheduler.

Build status

Build Status

Disclaimer

This project is highly experimental and therefore, NOT SUPPORTED. Moreover, we can and will change the API as necessary. The integrity of commit history is not guaranteed either. We might decide to clean up the history in the future.

Thus, use it at your own risk.

Dependency management

This project uses experimental approach to use a combination of asdf tool management and direnv. The direnv tool is brought by asdf-direnv plugin.

All tools managed by asdf are configured in .tool-versions which looks somewhat like the following:

java semeru-openj9-_openj9-
sbt 1.8.2
scala 2.13.8
erlang 25.0.2

The setup also tracks the host dependencies which are required by the project. These dependencies are specified in .deps file which looks like the following:

pkgutil:com.apple.pkg.CLTools_Executables::Open the App Store on the Mac, and search for Xcode.
brew:coreutils::brew install coreutils
asdf::brew install asdf
brew::/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The format of the lines in the file is {tool}::{hint_how_to_install}. The tool field can be in the one of the following forms:

  • pkgutil:{package}: for macOS packages, where package is the package id.
  • brew:{package}: for brew packages.
  • {binary}: for a given binary tool present in the path (we use type "${binary}" to check it).

Setting up the development environment

If you don't have asdf + asdf-direnv combination on your system already, there are extra steps that need to be done. The steps are documented in full details here. Essentially the steps are:

  1. Install asdf with brew install asdf
  2. Verify your OS has all tools we need using scripts/cli verify
  3. Use step-by-step guide script to finish installation (you might need to call it multiple times) scripts/cli bootstrap
  4. Restart your shell and cd into project directory
  5. Enable configuration by calling direnv allow

Running the build locally in Docker

Not supported.

The cli tool

In order to simplify project maintenance we provide a cli command. This command becomes available in your terminal when you cd into project directory.

Currently, cli provides following commands:

  • help - display help message
  • commands - list all commands
  • verify - verify developer setup
  • bootstrap - a step-by-step guide to help set up environment
  • fmt - reformat scala code

You can find detailed documentation here scripts/cli.md.

The plan is to implement things like

  • new exp {name} - to provision experiment template in experiments/ folder.
  • git {pr} - to check out GitHub PR locally ???
  • git tree - to display commit history as a tree
  • deps update - to update all Java/Scala dependencies
  • deps fetch - to fetch all Java/Scala to work offline
  • check all
  • check <spec>
  • run exp <Class>

All the above are just examples and not a firm commitment.

JMX + JConsole

JMX: A Java technology that provides tools for managing and monitoring applications, system objects, devices and service-oriented networks.

JConsole: A graphical monitoring tool to monitor Java Virtual Machine and Java applications both on a local or remote machine.

How to monitor metrics using jconsole:

  1. Run clouseau first, make clouseau1
  2. Open another terminal and type make jconsole
  3. Select MBeans -> com.cloudant.clouseau

jmx.png

Using sbt

actors / test
actors/testOnly com.cloudant.zio.actors.CodecSpec
actors/testOnly *CodecSpec
actors/testOnly *CodecSpec -- -DZIOSE_TEST_Generators=true
actors/testOnly *CodecSpec -- -DZIOSE_TEST_DEBUG=true
p
experiments/runMain com.cloudant.ziose.experiments.Hello

Using Read-Eval-Print Loop

sbt> console
[info] Starting scala interpreter...
Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 17).
Type in expressions for evaluation. Or try :help.

scala> import zio._
import zio._
scala> import zio.Console._
import zio.Console._
scala> import zio.stream.ZStream
import zio.stream.ZStream
scala> val stream = ZStream(1,2,3,4).merge(ZStream(9,8,7,6))
val stream: zio.stream.ZStream[Any,Nothing,Int] = zio.stream.ZStream@4368e720
scala> val tapped = stream.tap(x => printLine(s"${x}"))
val tapped: zio.stream.ZStream[Any,java.io.IOException,Int] = zio.stream.ZStream@14560718
scala> Unsafe.unsafe { implicit unsafe => Runtime.default.unsafe.run(tapped.runDrain) }
9
8
7
6
1
2
3
4
scala> :q