|
Revision 2820, 1.5 kB
(checked in by burt, 9 months ago)
|
First stab at fixing Trac ticket #18
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
import sys, time, os |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
sys.path.append(os.path.expandvars("$GIP_LOCATION/lib/python")) |
|---|
| 7 |
from gip_common import config, getTemplate, getLogger, printTemplate |
|---|
| 8 |
from gip_cluster import getSubClusterIDs, getClusterID |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
log = getLogger("GIP.timestamp") |
|---|
| 12 |
|
|---|
| 13 |
def main(): |
|---|
| 14 |
try: |
|---|
| 15 |
|
|---|
| 16 |
cp = config() |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
epoch = str(time.time()) |
|---|
| 20 |
now = time.strftime("%a %b %d %T UTC %Y", time.gmtime()) |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
template = getTemplate("GlueCluster", "GlueLocationLocalID") |
|---|
| 25 |
cluster_id = getClusterID(cp) |
|---|
| 26 |
for subClusterId in getSubClusterIDs(cp): |
|---|
| 27 |
|
|---|
| 28 |
info = {'locationId': 'TIMESTAMP', |
|---|
| 29 |
'subClusterId': subClusterId, |
|---|
| 30 |
'clusterId': cluster_id, |
|---|
| 31 |
'locationName': 'TIMESTAMP', |
|---|
| 32 |
'version': epoch, |
|---|
| 33 |
'path': now, |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
printTemplate(template, info) |
|---|
| 38 |
|
|---|
| 39 |
except Exception, e: |
|---|
| 40 |
|
|---|
| 41 |
log.error(e) |
|---|
| 42 |
sys.stdout = sys.stderr |
|---|
| 43 |
raise |
|---|
| 44 |
|
|---|
| 45 |
if __name__ == '__main__': |
|---|
| 46 |
main() |
|---|
| 47 |
|
|---|