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
dtm-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: dtm
9
@file dtm-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
import
ppath
18
from
ppath
import
sys
19
20
# For profiling
21
import
app.Profiler
as
Profiler
22
23
24
# Start profiling
25
pr = Profiler.Profiler()
26
if
pr
and
pr.status > 0:
27
pr.start()
28
29
30
from
dtmc.DTMC
import
DTMC
31
import
dtmc.DTMC
32
import
os
33
import
dtmc
34
35
from
app.Consts
import
EXIT_SUCCESS
36
from
app.Consts
import
EXIT_FAILURE
37
import
app.Consts
as
APP_CONSTS
38
39
40
# That script create main application
41
42
43
app =
None
44
exit_code = EXIT_SUCCESS
45
46
try
:
47
# create the app
48
app =
DTMC
()
49
# setup the application
50
app.setup()
51
# add support command line arguments
52
app.args.add_argument(
"-c"
,
"--config"
, action=
"store"
, required=
True
)
53
app.args.add_argument(
"-t"
,
"--task"
, action=
"store"
, required=
True
)
54
app.args.add_argument(
"-f"
,
"--file"
, action=
"store"
, required=
True
)
55
app.args.add_argument(
"-task_id"
,
"--id"
, action=
"store"
)
56
57
# run the application
58
app.run()
59
60
exit_code = app.errorCode
61
62
# log message about profiler
63
if
pr.errorMsg
and
dtmc.DTMC.logger:
64
dtmc.DTMC.logger.error(pr.errorMsg)
65
66
except
Exception
as
err:
67
if
dtmc.DTMC.logger:
68
dtmc.DTMC.logger.error(str(err))
69
exit_code = EXIT_FAILURE
70
except
:
71
exit_code = EXIT_FAILURE
72
finally
:
73
# stop profiling
74
if
pr:
75
pr.stop()
76
# close the app
77
if
app:
78
app.close()
79
80
sys.stdout.flush()
81
os._exit(exit_code)
dtmc.DTMC
Definition:
DTMC.py:1
dtmc.DTMC.DTMC
DTMC Class contents main functional of DTMC application, class inherits from foundation.CementApp.
Definition:
DTMC.py:39
app.Consts
Definition:
Consts.py:1
app.Profiler
Definition:
Profiler.py:1
sources
bin
dtm-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