Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
argotk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argo
argotk
Commits
09b37e85
Commit
09b37e85
authored
Mar 22, 2019
by
Valentin Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix refactor bugs
parent
e98124d9
Pipeline
#6119
passed with stages
in 2 minutes and 14 seconds
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
31 deletions
+46
-31
src/Argo/Args.hs
src/Argo/Args.hs
+8
-3
src/Argo/Stack.hs
src/Argo/Stack.hs
+12
-13
src/Argo/Utils.hs
src/Argo/Utils.hs
+26
-15
No files found.
src/Argo/Args.hs
View file @
09b37e85
...
...
@@ -13,11 +13,16 @@ module Argo.Args
)
where
import
Argo.Types
import
Argo.Types
(
ProcessBehavior
,
Verbosity
(
..
)
,
StackArgs
(
..
)
)
import
Options.Applicative
as
OA
import
Options.Applicative.Types
import
Options.Applicative.Builder
(
option
)
import
Turtle
hiding
(
option
)
import
Options.Applicative.Types
(
Parser
,
ReadM
,
readerAsk
)
import
Prelude
hiding
(
FilePath
)
behavior
::
ReadM
ProcessBehavior
...
...
src/Argo/Stack.hs
View file @
09b37e85
...
...
@@ -30,9 +30,9 @@ module Argo.Stack
)
where
import
Protolude
import
qualified
Prelude
(
show
)
import
Argo.Types
import
qualified
Prelude
(
show
)
import
Protolude
import
Data.Coerce
(
coerce
)
...
...
@@ -41,9 +41,7 @@ import Data.Foldable ( for_ )
import
Data.Text
as
T
hiding
(
empty
)
import
Data.Traversable
(
for
)
{-import System.Process as P-}
{-hiding ( shell )-}
import
Text.Show.Pretty
import
System.Directory
import
System.Process.Typed
(
readProcessStdout_
,
runProcess_
,
runProcess
...
...
@@ -51,7 +49,7 @@ import System.Process.Typed ( readProcessStdout_
,
shell
,
setEnv
)
import
System.Director
y
import
Text.Show.Prett
y
cleanLeftovers
::
WorkingDirectory
->
IO
()
cleanLeftovers
(
WorkingDirectory
wd
)
=
do
...
...
@@ -73,12 +71,13 @@ prepareDaemon
->
Maybe
TestText
->
Verbosity
->
PowerCap
->
[(
EnvVar
,
Text
)]
->
IO
Instrumentation
prepareDaemon
out
stdErr
test
v
powercap
=
do
prepareDaemon
out
stdErr
test
v
powercap
vars
=
do
let
confPath'
=
"/tmp/argo_nodeos_config"
cleanContainers
confPath'
return
$
Instrumentation
(
setEnv
[(
"ARGO_NODEOS_CONFIG"
,
toS
confPath'
)]
(
setEnv
((
castArg
<$>
vars
)
++
[(
"ARGO_NODEOS_CONFIG"
,
toS
confPath'
)])
$
proc
"daemon"
$
toS
<$>
[
"--nrm_log"
,
"./nrm_log"
]
...
...
@@ -89,6 +88,7 @@ prepareDaemon out stdErr test v powercap = do
stdErr
test
where
castArg
(
EnvVar
varname
,
y
)
=
(
toS
varname
,
toS
y
)
nodeOsFailure
n
=
do
printError
$
"argo_nodeos_config failed with exit code :"
<>
show
n
doesFileExist
".argo_nodeos_config_exit_message"
>>=
\
case
...
...
@@ -121,7 +121,7 @@ cmdRunI (AppName app) args (ContainerName cn) (ShareDir md) (ManifestName mn) va
pp
=
proc
"cmd"
$
toS
<$>
[
"run"
,
"-u"
,
cn
,
md
<>
"
manifests"
<>
"
/"
<>
mn
,
app
]
<$>
[
"run"
,
"-u"
,
cn
,
md
<>
"
/manifests
/"
<>
mn
,
app
]
++
fmap
argToText
args
cmdListenI
...
...
@@ -180,13 +180,12 @@ runStack sa@StackArgs {..} = do
when
(
powercap
/=
None
)
$
do
user
<-
readProcessStdout_
(
proc
"whoami"
[]
)
for_
([
0
,
1
]
::
[
Int
])
$
\
x
->
for_
([
0
,
1
]
::
[
Int
])
$
\
x
->
chownPowercapFiles
(
toS
user
)
$
"/sys/devices/virtual/powercap/intel-rapl/intel-rapl:"
<>
show
x
cleanLeftovers
workingDirectory
runProcess
(
proc
"mkdir"
[
"-p"
,
toS
wd
])
>>=
\
case
ExitFailure
_
->
die
$
"couldn't create "
<>
wd
ExitSuccess
->
return
()
...
...
@@ -195,10 +194,10 @@ runStack sa@StackArgs {..} = do
DontRun
->
return
Nothing
JustRun
stdOut
stdErr
->
(
\
i
->
Just
(
Daemon
,
i
))
<$>
prepareDaemon
stdOut
stdErr
Nothing
verbosity
powercap
<$>
prepareDaemon
stdOut
stdErr
Nothing
verbosity
powercap
vars
Test
t
stdOut
stdErr
->
(
\
i
->
Just
(
Daemon
,
i
))
<$>
prepareDaemon
stdOut
stdErr
(
Just
t
)
Verbose
powercap
<$>
prepareDaemon
stdOut
stdErr
(
Just
t
)
Verbose
powercap
vars
let
milist
::
[
Maybe
(
StackI
,
Instrumentation
)]
milist
=
...
...
src/Argo/Utils.hs
View file @
09b37e85
...
...
@@ -181,13 +181,17 @@ untilMatch msg sawTraceback = await >>= \case
Nothing
->
return
Clean
configureConduits
::
WorkingDirectory
->
ProcessConfig
()
()
()
::
WorkingDirectory
->
ProcessConfig
()
()
()
->
ProcessConfig
()
(
ConduitM
()
ByteString
IO
()
)
(
ConduitM
()
ByteString
IO
()
)
configureConduits
(
WorkingDirectory
wd
)
p
=
setStdout
createSource
$
setStderr
createSource
$
setStdin
closed
$
setWorkingDir
(
toS
wd
)
p
setStdout
createSource
$
setStderr
createSource
$
setStdin
closed
$
setWorkingDir
(
toS
wd
)
p
withConduitSinks
::
Text
...
...
@@ -206,12 +210,20 @@ withSinkFileNoBuffering filepath inner =
run
$
inner
$
sinkHandle
h
runI
::
WorkingDirectory
->
Instrumentation
::
WorkingDirectory
->
Instrumentation
->
IO
(
Either
MonitoringResult
(
ExitCode
,
TracebackScan
,
TracebackScan
))
runI
workDir
(
Instrumentation
crProc
(
StdOutLog
stdOut
)
(
StdErrLog
stdErr
)
t
)
=
try
$
withConduitSinks
stdOut
stdErr
$
\
outSink
errSink
->
runI
workDir
@
(
WorkingDirectory
wd
)
(
Instrumentation
crProc
(
StdOutLog
stdOut
)
(
StdErrLog
stdErr
)
t
)
=
try
$
withConduitSinks
(
wd
<>
"/"
<>
stdOut
)
(
wd
<>
"/"
<>
stdErr
)
$
\
outSink
errSink
->
withProcess
(
configureConduits
workDir
crProc
)
$
\
p
->
withAsyncConduitsOnProcess
p
outSink
outTest
errSink
errTest
waitEither
withAsyncConduitsOnProcess
p
outSink
outTest
errSink
errTest
waitEither
>>=
\
case
Left
Clean
->
(,
Clean
,
Clean
)
<$>
waitExitCode
p
Right
Clean
->
(,
Clean
,
Clean
)
<$>
waitExitCode
p
...
...
@@ -227,7 +239,6 @@ runI workDir (Instrumentation crProc (StdOutLog stdOut) (StdErrLog stdErr) t) =
(
Just
tOut
,
Just
tErr
)
Nothing
->
(
Nothing
,
Nothing
)
processBehaviorToI
::
ProcessConfig
()
()
()
->
ProcessBehavior
->
Maybe
Instrumentation
processBehaviorToI
crProc
=
\
case
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment