Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
padmwsverify
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stw
wt
padmwsverify
Commits
eda90500
Commit
eda90500
authored
Feb 13, 2017
by
Tomas Pettersson
🏸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better paths
parent
c677c2a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
build/SMHI-padmwsverify.spec
build/SMHI-padmwsverify.spec
+3
-0
run/output/helcom_nemo_1.txt
run/output/helcom_nemo_1.txt
+1
-1
run/run.py
run/run.py
+14
-8
No files found.
build/SMHI-padmwsverify.spec
View file @
eda90500
...
...
@@ -17,6 +17,7 @@ Group: Applications/Webb/System
URL: http://www.smhi.se
Source: padmwsverify.tar
Source1: extras.zip
Requires: python-requests
%description
...
...
@@ -61,6 +62,8 @@ mv run${SMHI_MODE}.cfg run/run.cfg
chmod 400 run/run.cfg
rm -f run{utv,test,prod,demo}.cfg
chmod +x main.sh
chmod +x run/run.py
case "$SMHI_MODE" in
prod)
...
...
run/output/helcom_nemo_1.txt
View file @
eda90500
0
\ No newline at end of file
1
\ No newline at end of file
run/run.py
View file @
eda90500
...
...
@@ -7,13 +7,14 @@ import requests
from
requests.auth
import
HTTPBasicAuth
from
time
import
time
,
strftime
,
sleep
from
datetime
import
datetime
,
timedelta
from
pprint
import
pprint
from
ConfigParser
import
SafeConfigParser
global
path
class
Runner
(
object
):
def
__init__
(
self
):
settings
=
SafeConfigParser
()
settings
.
read
(
'run
/run.cfg'
)
settings
.
read
(
path
+
'
/run.cfg'
)
self
.
url
=
settings
.
get
(
'misc'
,
'url'
);
self
.
usr
=
settings
.
get
(
'misc'
,
'usr'
);
self
.
pwd
=
settings
.
get
(
'misc'
,
'pwd'
);
...
...
@@ -47,10 +48,10 @@ class Runner(object):
end
=
time
()
# done
hasError
=
requests
.
get
(
'/'
.
join
([
self
.
url
,
"workarea"
,
"v2"
,
wid
,
"error.txt"
])).
status_code
==
200
with
open
(
'run
/output/'
+
name
+
'.txt'
,
'w'
)
as
outputfile
:
with
open
(
path
+
'
/output/'
+
name
+
'.txt'
,
'w'
)
as
outputfile
:
if
(
status
!=
'COMPLETE'
)
or
hasError
:
outputfile
.
write
(
'0'
)
with
open
(
'run
/output/'
+
name
+
'_'
+
datetime
.
utcnow
().
strftime
(
"%Y%m%d%H%M"
)
+
'.txt'
,
'w'
)
as
errorfile
:
with
open
(
path
+
'
/output/'
+
name
+
'_'
+
datetime
.
utcnow
().
strftime
(
"%Y%m%d%H%M"
)
+
'.txt'
,
'w'
)
as
errorfile
:
errorfile
.
write
(
wid
)
else
:
outputfile
.
write
(
'1'
)
...
...
@@ -59,7 +60,7 @@ class HELCOM_NEMO(Runner):
def
__init__
(
self
,
value
):
super
(
HELCOM_NEMO
,
self
).
__init__
()
self
.
name
=
'helcom_nemo_'
+
str
(
value
)
with
open
(
'run
/input/'
+
self
.
name
+
'.json'
)
as
file
:
with
open
(
path
+
'
/input/'
+
self
.
name
+
'.json'
)
as
file
:
self
.
jdata
=
json
.
load
(
file
)
def
__call__
(
self
):
super
(
HELCOM_NEMO
,
self
).
__call__
(
self
.
jdata
,
self
.
name
,
"HELCOM_NEMO"
)
...
...
@@ -68,7 +69,7 @@ class BF_NEMO(Runner):
def
__init__
(
self
,
value
):
super
(
BF_NEMO
,
self
).
__init__
()
self
.
name
=
'bf_nemo_'
+
str
(
value
)
with
open
(
'run
/input/'
+
self
.
name
+
'.json'
)
as
file
:
with
open
(
path
+
'
/input/'
+
self
.
name
+
'.json'
)
as
file
:
self
.
jdata
=
json
.
load
(
file
)
def
__call__
(
self
):
super
(
BF_NEMO
,
self
).
__call__
(
self
.
jdata
,
self
.
name
,
"BF_NEMO"
)
...
...
@@ -77,7 +78,7 @@ class VN_NEMO(Runner):
def
__init__
(
self
,
value
):
super
(
VN_NEMO
,
self
).
__init__
()
self
.
name
=
'vn_nemo_'
+
str
(
value
)
with
open
(
'run
/input/'
+
self
.
name
+
'.json'
)
as
file
:
with
open
(
path
+
'
/input/'
+
self
.
name
+
'.json'
)
as
file
:
self
.
jdata
=
json
.
load
(
file
)
def
__call__
(
self
):
super
(
VN_NEMO
,
self
).
__call__
(
self
.
jdata
,
self
.
name
,
"VN_NEMO"
)
...
...
@@ -94,7 +95,12 @@ def main():
except
Exception
as
error
:
print
error
sys
.
exit
(
1
)
'''
To run in terminal call with python run/run.py run
'''
if
__name__
==
"__main__"
:
path
=
'.'
if
(
len
(
sys
.
argv
)
>
1
):
path
=
sys
.
argv
[
1
]
main
()
\ No newline at end of file
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