Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
135c6d05
Commit
135c6d05
authored
16 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
colouring; indentation
parent
805b45e8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wmake/wmakeScheduler
+96
-93
96 additions, 93 deletions
wmake/wmakeScheduler
with
96 additions
and
93 deletions
wmake/wmakeScheduler
+
96
−
93
View file @
135c6d05
...
@@ -57,15 +57,15 @@ lockDir=$HOME/.wmakeScheduler
...
@@ -57,15 +57,15 @@ lockDir=$HOME/.wmakeScheduler
# count the total number of slots available and exit
# count the total number of slots available and exit
if
[
"
$1
"
=
"-count"
]
if
[
"
$1
"
=
"-count"
]
then
then
expr
$(
expr
$(
for
slotGroup
in
$WM_HOSTS
for
slotGroup
in
$WM_HOSTS
do
do
n
=
${
slotGroup
##*
:
}
n
=
${
slotGroup
##*
:
}
[
"
$n
"
=
"
${
slotGroup
%%
:
*
}
"
]
&&
n
=
1
# missing ':'
[
"
$n
"
=
"
${
slotGroup
%%
:
*
}
"
]
&&
n
=
1
# missing ':'
echo
"+
${
n
:-
1
}
"
echo
"+
${
n
:-
1
}
"
done
done
)
)
exit
0
exit
0
fi
fi
# where to source WM_PROJECT settings in a remote shell
# where to source WM_PROJECT settings in a remote shell
...
@@ -76,11 +76,11 @@ fi
...
@@ -76,11 +76,11 @@ fi
sourceFoam
=
false
# fallback command
sourceFoam
=
false
# fallback command
case
$SHELL
in
case
$SHELL
in
*
/csh
|
*
/tcsh
)
# [t]csh vs bash|ksh|sh
*
/csh
|
*
/tcsh
)
# [t]csh vs bash|ksh|sh
shellRc
=
cshrc
shellRc
=
cshrc
;;
;;
*
)
*
)
shellRc
=
bashrc
shellRc
=
bashrc
;;
;;
esac
esac
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
...
@@ -88,18 +88,18 @@ esac
...
@@ -88,18 +88,18 @@ esac
# check <installedProject>/etc/
# check <installedProject>/etc/
if
[
"
$WM_PROJECT
"
]
if
[
"
$WM_PROJECT
"
]
then
then
for
i
in
\
for
i
in
\
$HOME
/.
$WM_PROJECT
/
$WM_PROJECT_VERSION
\
$HOME
/.
$WM_PROJECT
/
$WM_PROJECT_VERSION
\
$HOME
/.
$WM_PROJECT
\
$HOME
/.
$WM_PROJECT
\
$WM_PROJECT_DIR
/etc
\
$WM_PROJECT_DIR
/etc
\
;
;
do
do
if
[
-f
"
$i
/
$shellRc
"
]
if
[
-f
"
$i
/
$shellRc
"
]
then
then
sourceFoam
=
"
$i
/
$shellRc
"
sourceFoam
=
"
$i
/
$shellRc
"
break
break
fi
fi
done
done
fi
fi
# Construct test string for remote execution.
# Construct test string for remote execution.
...
@@ -107,18 +107,18 @@ fi
...
@@ -107,18 +107,18 @@ fi
# attempt to preserve the installation directory 'FOAM_INST_DIR'
# attempt to preserve the installation directory 'FOAM_INST_DIR'
case
$sourceFoam
in
case
$sourceFoam
in
*
/bashrc
)
*
/bashrc
)
if
[
"
$FOAM_INST_DIR
"
]
if
[
"
$FOAM_INST_DIR
"
]
then
then
sourceFoam
=
'[ "$WM_PROJECT" ] || '
"FOAM_INST_DIR=
$FOAM_INST_DIR
.
$sourceFoam
"
sourceFoam
=
'[ "$WM_PROJECT" ] || '
"FOAM_INST_DIR=
$FOAM_INST_DIR
.
$sourceFoam
"
else
else
sourceFoam
=
'[ "$WM_PROJECT" ] || '
".
$sourceFoam
"
sourceFoam
=
'[ "$WM_PROJECT" ] || '
".
$sourceFoam
"
fi
fi
;;
;;
*
/cshrc
)
*
/cshrc
)
# TODO: csh equivalent to bash code (preserving FOAM_INST_DIR)
# TODO: csh equivalent to bash code (preserving FOAM_INST_DIR)
sourceFoam
=
'if ( ! $?WM_PROJECT ) source '
"
$sourceFoam
"
sourceFoam
=
'if ( ! $?WM_PROJECT ) source '
"
$sourceFoam
"
;;
;;
esac
esac
# quote double-quotes for remote command line
# quote double-quotes for remote command line
...
@@ -132,8 +132,8 @@ declare colourList
...
@@ -132,8 +132,8 @@ declare colourList
nColours
=
0
nColours
=
0
for
col
in
$WM_COLOURS
for
col
in
$WM_COLOURS
do
do
colourList[
$nColours
]=
$col
colourList[
$nColours
]=
$col
((
nColours
=
$nColours
+ 1
))
((
nColours
=
$nColours
+ 1
))
done
done
# Bashism: make pipe fail early.
# Bashism: make pipe fail early.
...
@@ -147,19 +147,19 @@ set -o pipefail
...
@@ -147,19 +147,19 @@ set -o pipefail
#
#
colourPipe
()
colourPipe
()
{
{
if
[
"
$1
"
]
if
[
"
$1
"
]
then
then
(
(
while
read
line
while
read
line
do
do
setterm
-foreground
$1
setterm
-foreground
$1
echo
"
$line
"
echo
"
$line
"
done
done
setterm
-foreground
default
setterm
-foreground
default
)
)
else
else
cat
cat
fi
fi
}
}
...
@@ -167,56 +167,59 @@ colourIndex=0
...
@@ -167,56 +167,59 @@ colourIndex=0
while
:
while
:
do
do
for
slotGroup
in
$WM_HOSTS
for
slotGroup
in
$WM_HOSTS
do
do
# split 'host:N', but catch 'host:' and 'host' too
# split 'host:N', but catch 'host:' and 'host' too
host
=
${
slotGroup
%%
:
*
}
host
=
${
slotGroup
%%
:
*
}
n
=
${
slotGroup
##*
:
}
n
=
${
slotGroup
##*
:
}
[
"
$n
"
=
"
$host
"
]
&&
n
=
1
# missing ':'
[
"
$n
"
=
"
$host
"
]
&&
n
=
1
# missing ':'
:
${
n
:
=1
}
:
${
n
:
=1
}
i
=
0
i
=
0
while
[
"
$i
"
-lt
"
$n
"
]
while
[
"
$i
"
-lt
"
$n
"
]
do
do
lockFile
=
"
$lockDir
/
$host
:
$i
"
lockFile
=
"
$lockDir
/
$host
:
$i
"
if
lockfile
-r0
"
$lockFile
"
2>/dev/null
if
lockfile
-r0
"
$lockFile
"
2>/dev/null
then
if
[
"
$nColours
"
-gt
0
]
then
then
# Set colour and index to next colour
if
[
"
$nColours
"
-gt
0
]
colour
=
"
${
colourList
[
$colourIndex
]
}
"
then
colourIndex
=
$(
expr
$colourIndex
+ 1
)
# Set colour
[
"
$colourIndex
"
-lt
"
$nColours
"
]
||
colourIndex
=
0
colour
=
"
${
colourList
[
$colourIndex
]
}
"
if
[
"
$host
"
=
"
$HOST
"
]
;
then
if
[
"
$host
"
=
"
$HOST
"
]
;
then
eval
$*
2>&1 | colourPipe
"
$colour
"
eval
$*
2>&1 | colourPipe
"
$colour
"
else
else
ssh
$host
"
$sourceFoam
2>/dev/null; cd
$PWD
&&
$rcmd
"
2>&1 | colourPipe
"
$colour
"
ssh
$host
"
$sourceFoam
2>/dev/null; cd
$PWD
&&
$rcmd
"
2>&1 | colourPipe
"
$colour
"
fi
fi
retval
=
$?
retval
=
$?
else
else
if
[
"
$host
"
=
"
$HOST
"
]
;
then
if
[
"
$host
"
=
"
$HOST
"
]
;
then
eval
$*
2>&1
eval
$*
2>&1
else
else
ssh
$host
"
$sourceFoam
2>/dev/null; cd
$PWD
&&
$rcmd
"
2>&1
ssh
$host
"
$sourceFoam
2>/dev/null; cd
$PWD
&&
$rcmd
"
2>&1
fi
fi
retval
=
$?
retval
=
$?
fi
# Release lock
rm
-f
"
$lockFile
"
2>/dev/null
exit
$retval
fi
fi
i
=
$(
expr
$i
+ 1
)
# Release lock
# Cycle through colours. Note: outside lock clause!
rm
-f
"
$lockFile
"
2>/dev/null
colourIndex
=
$(
expr
$colourIndex
+ 1
)
exit
$retval
[
"
$colourIndex
"
-lt
"
$nColours
"
]
||
colourIndex
=
0
fi
i
=
$(
expr
$i
+ 1
)
done
done
done
done
# Did not find any free slots. Rest a bit.
# Did not find any free slots. Rest a bit.
sleep
1
sleep
1
done
done
if
[
"
$nColours
"
-gt
0
]
if
[
"
$nColours
"
-gt
0
]
then
then
setterm
-foreground
default
setterm
-foreground
default
fi
fi
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment