Skip to content

Commit

Permalink
v0.47.2 - PeerJ submission (number two)
Browse files Browse the repository at this point in the history
The initial submission was flagged because I was missing code for the
comparison between morloc and other workflow approaches. When I
submitted the paper, I had no such code and meant the diagram to be more
conceptual. However, the editor's request was quite reasonable. So I
reimplemented the case study with bash, python, snakemake and nextflow.
This is all in a different repo. This release is needed for the
lighter-weight containers I want to share with my reviewers and readers.

 * made the build static
 * fixed the dockerfile
 * exported the vim-syntax file out to its own repo
 * added a --version option
 * upgraded to LTS 22.18
  • Loading branch information
arendsee committed Apr 29, 2024
2 parents bc05f3c + 10e108b commit 0c2ba86
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 216 deletions.
62 changes: 0 additions & 62 deletions container/Dockerfile

This file was deleted.

82 changes: 82 additions & 0 deletions container/ubuntu/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
###############################################################################
# Stage 1: Build the morloc compiler
FROM alpine:3.19 as morloc-build

RUN apk update \
&& apk add --no-cache git \
&& apk add --no-cache gmp-dev \
&& apk add --no-cache build-base \
&& apk add --no-cache ncurses \
&& apk add --no-cache curl

# Build morloc
RUN curl -SL https://get.haskellstack.org/ | sh

RUN git clone https://github.com/morloc-project/morloc

# Build morloc
RUN cd morloc && stack install


###############################################################################
# Stage 2: Copy just the compiler binary
FROM ubuntu:22.04 AS morloc-base
COPY --from=morloc-build /root/.local/bin/morloc /bin/morloc

WORKDIR $HOME

RUN apt-get update

# Set the timezone, this avoids hanging later on
RUN DEBIAN_FRONTEND=noninteractive TZ=Antarctica/Troll apt-get -y install tzdata

RUN apt-get install -y r-base python3.10 python3-pip libgsl-dev git

# Set up Python environment
RUN pip3.10 install pymorlocinternals

# Set up C++ environment
RUN mkdir -p $HOME/.morloc/include \
&& git clone https://github.com/morloclib/mlccpptypes $HOME/.morloc/include/mlccpptypes

# Set up R environment
RUN Rscript -e 'install.packages("remotes", repos = "https://cloud.r-project.org")'
RUN Rscript -e 'remotes::install_github("morloc-project/rmorlocinternals", dependencies=TRUE)'

# Setup the morloc home
RUN mkdir -p $HOME/.morloc/lib
RUN mkdir -p $HOME/.morloc/tmp
RUN echo "home : $HOME/.morloc" > ~/.morloc/config && \
echo "library : $HOME/.morloc/lib" >> $HOME/.morloc/config && \
echo "tmpdir : $HOME/.morloc/tmp" >> $HOME/.morloc/config && \
echo "lang_python3 : python3" >> $HOME/.morloc/config

# Install the morloc modules that are required for the morloc tests to pass
RUN morloc install prelude
RUN morloc install types
RUN morloc install conventions
RUN morloc install base
RUN morloc install rbase
RUN morloc install pybase
RUN morloc install cppbase
RUN morloc install math

RUN apt-get install -y vim

# Copy over custom vimrc
COPY assets/vimrc /root/.vimrc
COPY assets/README /root/README

# Set up vim highlighting for morloc
RUN git clone https://github.com/morloc-project/vimmorloc \
&& mkdir -p ~/.vim/syntax/ \
&& mkdir -p ~/.vim/ftdetect/ \
&& cp vimmorloc/loc.vim ~/.vim/syntax/ \
&& echo 'au BufRead,BufNewFile *.loc set filetype=loc' > ~/.vim/ftdetect/loc.vim \
&& rm -rf vimmorloc

RUN git clone https://github.com/morloc-project/morloc \
&& mv morloc/test-suite/golden-tests ~/tests

# Cleanup to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
7 changes: 7 additions & 0 deletions container/ubuntu/base/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build the required docker image
build:
docker build -t morloc-base .

# Open a shell
shell:
docker run -w "/root" -it morloc-base /bin/bash
5 changes: 5 additions & 0 deletions container/ubuntu/base/assets/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This container has a full morloc installation and language support for R, Python3, and C++.

The ~/tests folder contains a set of tests from the morloc test suite. These may
serve as simplistic examples of morloc scripts. Though they are designed for
testing the language not pedagogy.
16 changes: 16 additions & 0 deletions container/ubuntu/base/assets/vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
" Jump to the last position when reopening a file
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

" Load indentation rules and plugins according to the detected filetype.
filetype plugin indent on
syntax on
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned

" An OK colorscheme
colorscheme torte
8 changes: 6 additions & 2 deletions executable/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ module UI (
) where

import Options.Applicative
import qualified Options.Applicative.Extra as OAE

version :: String
version = "v0.47.2" -- FIXME: HARDCODED VERSION NUMBER!!!

opts :: ParserInfo CliCommand
opts = info (cliParser <**> helper)
opts = info (cliParser <**> helper <**> OAE.simpleVersioner version)
( fullDesc
<> progDesc "call 'morloc make -h', 'morloc install -h', etc for details"
<> header "morloc v0.47.1" -- FIXME: HARDCODED VERSION NUMBER!!!
<> header ("morloc " <> version)
)


Expand Down
14 changes: 7 additions & 7 deletions library/Morloc/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ module Morloc.Config
import Morloc.Data.Doc
import Morloc.Namespace
import qualified Morloc.Language as ML
import qualified Data.HashMap.Strict as H
import qualified Data.Yaml.Config as YC
import qualified Morloc.Data.Text as MT
import qualified Morloc.System as MS
import qualified Data.Aeson.KeyMap as K


getDefaultConfigFilepath :: IO Path
Expand All @@ -35,10 +35,10 @@ loadDefaultMorlocConfig = do
defaults <- defaultFields
return $
Config
(MT.unpack $ defaults H.! "home")
(MT.unpack $ defaults H.! "source")
(MT.unpack $ defaults H.! "plane")
(MT.unpack $ defaults H.! "tmpdir")
(MT.unpack . fromJust $ defaults K.!? "home")
(MT.unpack . fromJust $ defaults K.!? "source")
(MT.unpack . fromJust $ defaults K.!? "plane")
(MT.unpack . fromJust $ defaults K.!? "tmpdir")
"python3" -- lang_python3
"Rscript" -- lang_R
"perl" -- lang_perl
Expand Down Expand Up @@ -86,12 +86,12 @@ buildPoolCallBase c (Just Python3Lang) i =
buildPoolCallBase _ _ _ = Nothing -- FIXME: add error handling

-- A key value map
defaultFields :: IO (H.HashMap MT.Text MT.Text)
defaultFields :: IO (K.KeyMap MT.Text)
defaultFields = do
home <- MT.pack <$> getDefaultMorlocHome
lib <- MT.pack <$> getDefaultMorlocSource
tmp <- MT.pack <$> getDefaultMorlocTmpDir
return $ H.fromList [("home", home), ("source", lib), ("plane", "morloclib"), ("tmpdir", tmp)]
return $ K.fromList [("home", home), ("source", lib), ("plane", "morloclib"), ("tmpdir", tmp)]

-- | Get the Morloc home directory (absolute path)
getDefaultMorlocHome :: IO Path
Expand Down
14 changes: 13 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: morloc
version: 0.47.1
version: 0.47.2
homepage: https://github.com/morloc-project/morloc
synopsis: A multi-lingual, typed, workflow language
description: See GitHub README <https://github.com/morloc-project/morloc#readme>
Expand All @@ -16,6 +16,9 @@ extra-source-files:
- README.md
- ChangeLog.md

default-extensions:
- TypeOperators

dependencies:
- base
- aeson
Expand Down Expand Up @@ -68,7 +71,16 @@ executables:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -O2
# The static build requires a static `libgmp.a` file
# On arch, this requires libgmp-static from AUR
# On debian systems, libgmp-dev should cover it
- -static
- -haddock
cc-options:
- -static
ld-options:
- -static
dependencies:
- morloc
- base
Expand Down
10 changes: 5 additions & 5 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-18.28
resolver: lts-22.18

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand All @@ -37,10 +37,10 @@ resolver: lts-18.28
# will not be run. This is useful for tweaking upstream packages.
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:
- partial-order-0.2.0.0@sha256:a0d6ddc9ebcfa965a5cbcff1d06d46a79d44ea5a0335c583c2a51bcb41334487,2275
# # Dependency packages to be pulled from upstream that are not in the resolver
# # (e.g., acme-missiles-0.3)
# extra-deps:
# - partial-order-0.2.0.0@sha256:a0d6ddc9ebcfa965a5cbcff1d06d46a79d44ea5a0335c583c2a51bcb41334487,2275

# Override default flag values for local packages and extra-deps
# flags: {}
Expand Down
Loading

0 comments on commit 0c2ba86

Please sign in to comment.