HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.
2.0.0-chaika
Hierarchical Cluster Engine Python language binding
dc-client.py
Go to the documentation of this file.
1
#!/usr/bin/python
2
3
4
"""
5
HCE project, Python bindings, Distributed Tasks Manager application.
6
Event objects definitions.
7
8
@package: dc
9
@file dc-client.py
10
@author Oleksii <developers.hce@gmail.com>
11
@link: http://hierarchical-cluster-engine.com/
12
@copyright: Copyright © 2013-2014 IOIX Ukraine
13
@license: http://hierarchical-cluster-engine.com/license/
14
@since: 0.1
15
"""
16
17
18
import
ppath
19
from
ppath
import
sys
20
21
# For profiling
22
import
app.Profiler
as
Profiler
23
24
25
# Start profiling
26
pr = Profiler.Profiler()
27
if
pr
and
pr.status > 0:
28
pr.start()
29
30
31
from
dcc.DCC
import
DCC
32
import
dcc.DCC
33
import
os
34
import
sys
35
import
logging.config
36
37
from
app.Consts
import
EXIT_SUCCESS
38
from
app.Consts
import
EXIT_FAILURE
39
import
app.Consts
as
APP_CONSTS
40
import
dcc.Constants
as
CONSTANTS
41
42
# That script create main application
43
44
45
app =
None
46
exit_code = EXIT_SUCCESS
47
48
try
:
49
# create the app
50
app =
DCC
()
51
# setup the application
52
app.setup()
53
# add support command line arguments
54
app.args.add_argument(
"-c"
,
"--config"
, action=
"store"
, metavar=
'config_file'
, help=
'config ini-file'
, required=
True
)
55
additionHelpStr = CONSTANTS.HELP_COMMAND_TEMPLATE + str(CONSTANTS.TASKS)
56
app.args.add_argument(
"-cmd"
,
"--command"
, action=
"store"
, metavar=
'command'
, help=additionHelpStr)
57
app.args.add_argument(
"-f"
,
"--file"
, action=
"store"
, metavar=
'file name'
)
58
app.args.add_argument(
"-mrg"
,
"--merge"
, action=
"store"
, metavar=
'merge'
)
59
app.args.add_argument(
"-ff"
,
"--fields"
, action=
"store"
, metavar=
'fields'
)
60
app.args.add_argument(
"-mode"
,
"--mode"
, action=
"store"
, metavar=
'mode'
)
61
app.args.add_argument(
"-v"
,
"--verbose"
, action=
"store"
, metavar=
'verbose'
)
62
app.args.add_argument(
"-dcc_timeout"
,
"--dcc_timeout"
, action=
"store"
, metavar=
'timeout value'
)
63
app.args.add_argument(
"-dcc_clientHost"
,
"--dcc_clientHost"
, metavar=
'client host'
)
64
app.args.add_argument(
"-dcc_clientPort"
,
"--dcc_clientPort"
, metavar=
'client port'
)
65
app.args.add_argument(
"-o"
,
"--output_file"
, action=
"store"
, metavar=
'output file name'
)
66
app.args.add_argument(
"-e"
,
"--error_file"
, action=
"store"
, metavar=
'error file name'
)
67
68
69
# run the application
70
app.run()
71
72
exit_code = app.errorCode
73
74
# log message about profiler
75
if
pr.errorMsg
and
dcc.DCC.logger:
76
dcc.DCC.logger.error(pr.errorMsg)
77
78
except
Exception
as
err:
79
if
dcc.DCC.logger:
80
dcc.DCC.logger.error(str(err))
81
exit_code = EXIT_FAILURE
82
except
:
83
exit_code = EXIT_FAILURE
84
finally
:
85
# stop profiling
86
if
pr:
87
pr.stop()
88
# close the app
89
if
app:
90
app.close()
91
92
sys.stdout.flush()
93
os._exit(exit_code)
dcc.DCC
Definition:
DCC.py:1
dcc.DCC.DCC
Definition:
DCC.py:35
app.Consts
Definition:
Consts.py:1
app.Profiler
Definition:
Profiler.py:1
dcc.Constants
Definition:
Constants.py:1
sources
bin
dc-client.py
Generated on Fri Nov 24 2017 18:53:52 for HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings. by
1.8.13