packages feed

batchd (empty) → 0.1.0.0

raw patch · 6 files changed

+342/−0 lines, 6 filesdep +Globdep +aesondep +basesetup-changed

Dependencies added: Glob, aeson, base, bytestring, connection, containers, cryptonite, data-default, dates, directory, esqueleto, filepath, http-client, http-client-tls, http-types, libssh2, monad-logger, monad-logger-syslog, mtl, optparse-applicative, parsec, persistent, persistent-postgresql, persistent-sqlite, persistent-template, process, readline, resourcet, scotty, syb, template, template-haskell, text, th-lift, time, tls, transformers, unix, unordered-containers, vault, wai, wai-cors, wai-extra, wai-middleware-static, warp, x509-store, yaml

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016, Ilya Portnov++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Ilya Portnov nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ batchd.cabal view
@@ -0,0 +1,190 @@+name:                batchd+version:             0.1.0.0+synopsis:            Batch processing toolset for Linux / Unix+description:         The batchd is a toolset for batch processing for Linux / Unix operating systems.+                     It enables one to:+                     .+                     * Create and manage queues of tasks (batch jobs);+                     .+                     * Specify time periods (schedules) when jobs from each queue can be executed;+                     .+                     * Run batch jobs on localhost or on several machines one-by-one or in parallel.+                     .+                     The main concern of batchd are batch jobs, which are+                     meant to take some time to execute (minutes to days) and+                     consume a lot of computational power (probably whole+                     power of the machine). Examples of such jobs are:+                     .+                     * Scientific calculations (physical modelling or numeric+                       experiments on differential equations, for example);+                     .+                     * Building large software products from source code;+                     .+                     * Running integration test suites;+                     .+                     * Rendering complex 3D scenes or animations;+                     .+                     * Executing complex reports on large databases;+                     .+                     * Backups;+                     .+                     * and so on.+                     .+                     For more complete description, please refer to+                     <https://github.com/portnov/batchd/blob/master/README.md README>+                     and <https://github.com/portnov/batchd/wiki Wiki> on GitHub.+++Homepage:            https://github.com/portnov/batchd+license:             BSD3+license-file:        LICENSE+author:              Ilya Portnov+maintainer:          portnov84@rambler.ru+-- copyright:           +category:            System+build-type:          Simple+-- extra-source-files:  +cabal-version:       >=1.10++executable batchd+  main-is:             batchd.hs+  hs-source-dirs:      src/+  -- other-modules:       +  other-extensions:    TypeFamilies, DeriveDataTypeable, TemplateHaskell, StandaloneDeriving, RecordWildCards+  build-depends:       base >=4.7 && <5.0,+                       persistent >= 2.2,+                       persistent-sqlite >= 2.2,+                       persistent-postgresql >= 2.2,+                       persistent-template >= 2,+                       esqueleto >= 2.4,+                       monad-logger >= 0.3,+                       monad-logger-syslog >= 0.1,+                       data-default >= 0.5,+                       mtl >=2.2 && <2.3,+                       transformers >= 0.5,+                       dates >=0.2 && <0.3,+                       filepath >= 1.3,+                       directory >= 1.2,+                       Glob >= 0.7.5,+                       time >=1.4 && <1.7,+                       syb >=0.6 && <0.7,+                       containers >=0.5 && <0.6,+                       unordered-containers >= 0.2,+                       resourcet >= 1.1.7,+                       http-types >= 0.9,+                       wai >= 3.0,+                       wai-extra >= 3.0,+                       wai-cors >= 0.2.5,+                       wai-middleware-static >= 0.8.1,+                       vault,+                       scotty >= 0.10,+                       warp >= 3.2,+                       aeson >= 0.11,+                       yaml >= 0.8.4,+                       text >= 1.2,+                       parsec >= 3.1,+                       bytestring >= 0.10,+                       optparse-applicative >= 0.13.2.0,+                       template >= 0.2,+                       process >= 1.2.3.0,+                       libssh2 >= 0.2,+                       cryptonite >= 0.23,+                       template-haskell >= 2.8,+                       th-lift >= 0.6+  -- hs-source-dirs:      +  ghc-options: -fwarn-unused-imports -fwarn-missing-signatures -threaded+  default-language:    Haskell2010++executable batchd-admin+  main-is:             batchd-admin.hs+  hs-source-dirs:      src/+  -- other-modules:       +  other-extensions:    TypeFamilies, DeriveDataTypeable, TemplateHaskell, StandaloneDeriving, RecordWildCards+  build-depends:       base >=4.7 && <5.0,+                       persistent >= 2.2,+                       persistent-sqlite >= 2.2,+                       persistent-postgresql >= 2.2,+                       persistent-template >= 2,+                       esqueleto >= 2.4,+                       monad-logger >= 0.3,+                       monad-logger-syslog >= 0.1,+                       data-default >= 0.5,+                       mtl >=2.2 && <2.3,+                       transformers >= 0.5,+                       dates >=0.2 && <0.3,+                       filepath >= 1.3,+                       directory >= 1.2,+                       Glob >= 0.7.5,+                       time >=1.4 && <1.7,+                       syb >=0.6 && <0.7,+                       containers >=0.5 && <0.6,+                       unordered-containers >= 0.2,+                       resourcet >= 1.1.7,+                       http-types >= 0.9,+                       wai >= 3.0,+                       wai-extra >= 3.0,+                       vault,+                       scotty >= 0.10,+                       warp >= 3.2,+                       aeson >= 0.11,+                       yaml >= 0.8.4,+                       text >= 1.2,+                       parsec >= 3.1,+                       bytestring >= 0.10,+                       optparse-applicative >= 0.13.2.0,+                       template >= 0.2,+                       process >= 1.2.3.0,+                       libssh2 >= 0.2,+                       cryptonite >= 0.23,+                       template-haskell >= 2.8,+                       th-lift >= 0.6+  -- hs-source-dirs:      +  ghc-options: -fwarn-unused-imports -fwarn-missing-signatures -threaded+  default-language:    Haskell2010+executable batch+  main-is:             batch.hs+  hs-source-dirs:      src/+  -- other-modules:       +  build-depends:       base >=4.7 && <5.0,+                       data-default >= 0.5,+                       mtl >=2.2 && <2.3,+                       transformers >= 0.5,+                       dates >=0.2 && <0.3,+                       filepath >= 1.3,+                       directory >= 1.2,+                       time >=1.4 && <1.7,+                       syb >=0.6 && <0.7,+                       containers >=0.5 && <0.6,+                       unordered-containers >= 0.2,+                       monad-logger >= 0.3,+                       readline >= 1.0.3.0,+                       x509-store >= 1.6.2,+                       tls >= 1.3.10,+                       connection >= 0.2.8,+                       http-types >= 0.9,+                       http-client >= 0.5.6.1,+                       http-client-tls >= 0.3.4.2,+                       aeson >= 0.11,+                       yaml >= 0.8.4,+                       text >= 1.2,+                       parsec >= 3.1,+                       bytestring >= 0.10,+                       optparse-applicative >= 0.13.2.0,+                       persistent >= 2.2,+                       persistent-template >= 2,+                       persistent-sqlite >= 2.2,+                       persistent-postgresql >= 2.2,+                       esqueleto >= 2.4,+                       monad-logger >= 0.3,+                       monad-logger-syslog >= 0.1,+                       resourcet >= 1.1.7,+                       unix >= 2.7.0,+                       scotty >= 0.10++  ghc-options: -fwarn-unused-imports -fwarn-missing-signatures+  default-language:    Haskell2010++Source-repository head+  type: git+  location: https://github.com/portnov/batchd.git+
+ src/batch.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}++import Control.Exception+import Data.Maybe++import Client.Types+import Client.Actions+import Client.CmdLine+import Client.Config+import Client.Monad+import Client.Http+import Client.Shell++main :: IO ()+main = realMain `catch` errorHandler++errorHandler :: ClientException -> IO ()+errorHandler (ClientException e) = putStrLn $ "Error: " ++ e++realMain :: IO ()+realMain = do+  opts <- getCmdArgs+  -- print opts++  manager <- makeClientManager opts+  cfg <- loadClientConfig+  let state = ClientState opts cfg Nothing Nothing manager++  runClient state $ commandHandler+
+ src/batchd-admin.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveDataTypeable #-}++import Data.Semigroup ((<>))+import Options.Applicative++import Common.Types+import Common.Config+import Daemon.Database+import Daemon.Auth++data Admin =+  CreateSuperuser {userName :: String}+  deriving (Show)++createSuperuser :: Parser Admin+createSuperuser = CreateSuperuser+  <$> strArgument (metavar "NAME" <> help "name of user to create" <> value "root" <> showDefault)++parser :: Parser Admin+parser =+  hsubparser+    (command "create-superuser" (info createSuperuser (progDesc "create super user")))++parserInfo :: ParserInfo Admin+parserInfo = info (parser <**> helper)+               (fullDesc+               <> header "batchd-admin - the batchd toolset administrative utility")++main :: IO ()+main = do+  cmd <- execParser parserInfo+  cfgR <- loadGlobalConfig+  case cfgR of+    Left err -> fail $ show err+    Right cfg -> do+      password <- getPassword2+      createSuperUser cfg (userName cmd) password+      return ()+
+ src/batchd.hs view
@@ -0,0 +1,47 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveDataTypeable #-}++import Control.Concurrent+import Data.Semigroup ((<>))+import Options.Applicative++import Common.Types+import Common.Config+import Daemon.Database+import Daemon.Manager as Manager+import Daemon.Dispatcher as Dispatcher++parser :: Parser DaemonMode+parser =+  hsubparser+    (  command "both"       (info (pure Both) (progDesc "run both manager and dispatcher"))+    <> command "manager"    (info (pure Manager) (progDesc "run manager"))+    <> command "dispatcher" (info (pure Dispatcher) (progDesc "run dispatcher"))+    )+  <|> pure Both++parserInfo :: ParserInfo DaemonMode+parserInfo = info (parser <**> helper)+               (fullDesc+               <> header "batchd - the batchd toolset daemon server-side program"+               <> progDesc "process client requests and / or execute batch jobs" )++main :: IO ()+main = do+  cmd <- execParser parserInfo+  cfgR <- loadGlobalConfig+  case cfgR of+    Left err -> fail $ show err+    Right cfg -> do+      let mode = if cmd == Both+                   then dbcDaemonMode cfg+                   else cmd+      pool <- getPool cfg+      case mode of+        Manager    -> Manager.runManager cfg pool+        Dispatcher -> Dispatcher.runDispatcher cfg pool+        Both -> do+          forkIO $ Manager.runManager cfg pool+          Dispatcher.runDispatcher cfg pool+