Skip to content

Commit

Permalink
Merge pull request #35 from ARGOeu/devel
Browse files Browse the repository at this point in the history
December release
  • Loading branch information
skanct committed Mar 4, 2015
2 parents 77cb5ba + 4180ac9 commit 57131ff
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 67 deletions.
15 changes: 10 additions & 5 deletions ar-sync.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: ar-sync
Summary: A/R Comp Engine sync scripts
Version: 1.3.1
Release: 12%{?dist}
Release: 16%{?dist}
License: ASL 2.0
Buildroot: %{_tmppath}/%{name}-buildroot
Group: EGI/SA4
Expand Down Expand Up @@ -41,8 +41,6 @@ install --mode 644 etc/ar-sync/hepspec-sync.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/hepspec-sync.EGI.Cloudmon.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/hepspec-sync.EGI.Critical.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/prefilter-avro.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/prefilter-avro.EGI.Cloudmon.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/prefilter-avro.EGI.Critical.conf %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/poem_name_mapping.cfg %{buildroot}/var/lib/ar-sync/
install --mode 644 etc/ar-sync/downtimes.avsc %{buildroot}/etc/ar-sync/
install --mode 644 etc/ar-sync/metric_profiles.avsc %{buildroot}/etc/ar-sync/
Expand Down Expand Up @@ -91,8 +89,6 @@ install --mode 644 cronjobs/hepspec %{buildroot}/etc/cron.d/hepspec
%config(noreplace) /etc/ar-sync/hepspec-sync.EGI.Cloudmon.conf
%config(noreplace) /etc/ar-sync/hepspec-sync.EGI.Critical.conf
%config(noreplace) /etc/ar-sync/prefilter-avro.conf
%config(noreplace) /etc/ar-sync/prefilter-avro.EGI.Cloudmon.conf
%config(noreplace) /etc/ar-sync/prefilter-avro.EGI.Critical.conf
%config(noreplace) /etc/ar-sync/downtimes.avsc
%config(noreplace) /etc/ar-sync/metric_profiles.avsc
%config(noreplace) /etc/ar-sync/group_endpoints.avsc
Expand All @@ -108,6 +104,15 @@ install --mode 644 cronjobs/hepspec %{buildroot}/etc/cron.d/hepspec
%attr(0644,root,root) /etc/cron.d/hepspec

%changelog
* Tue Feb 17 2015 Daniel Vrcic <[email protected]> - 1.3.1-16%(?dist)
- prefilter-avro has fixed configuration
* Thu Feb 12 2015 Daniel Vrcic <[email protected]> - 1.3.1-15%(?dist)
- legacy SRM service type handle for downtime syncs
* Tue Feb 10 2015 Daniel Vrcic <[email protected]> - 1.3.1-14%(?dist)
- updated .spec with removed configs for a per job prefilter-avro
* Tue Feb 10 2015 Daniel Vrcic <[email protected]> - 1.3.1-13%(?dist)
- different internal handle of avro poem-sync so it doesn't contain duplicated entries
- special handle of legacy SRM service type
* Thu Feb 5 2015 Daniel Vrcic <[email protected]> - 1.3.1-12%(?dist)
- plaintxt prefilter has fixed configuration
* Tue Feb 3 2015 Daniel Vrcic <[email protected]> - 1.3.1-11%(?dist)
Expand Down
10 changes: 10 additions & 0 deletions bin/downtime-sync
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ from avro.datafile import DataFileWriter
from avro.io import DatumWriter

defaultConfig = '/etc/ar-sync/downtime-sync.conf'

LegMapServType = {'SRM' : 'SRMv2'}
defaultArgDateFormat = '%Y-%m-%d'

readers = ['gocdb']
Expand Down Expand Up @@ -201,6 +203,11 @@ class FileWritter(DowntimeWriter):
dt['service'],
dt['start_time'],
dt['end_time'], ))
if dt['service'] in LegMapServType.keys():
outFile.write(self.outputFileFormat % (dt['hostname'],
LegMapServType[dt['service']],
dt['start_time'],
dt['end_time'], ))
outFile.close();

class AvroWritter(DowntimeWriter):
Expand All @@ -227,6 +234,9 @@ class AvroWritter(DowntimeWriter):

for dt in downtimes:
writer.append(dt)
if dt['service'] in LegMapServType.keys():
dt['service'] = LegMapServType[dt['service']]
writer.append(dt)

writer.close()
avroFile.close()
Expand Down
26 changes: 16 additions & 10 deletions bin/poem-sync
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ class PoemReader(ProfileReader):
#sys.stdout.write("vp: " + pp.pformat(validProfiles) + '\n\n')
#sys.stdout.flush()

profileList = list()
profileList = []
profileListAvro = []

for line in poemServers:
if len(line) == 0 or line[0] == '#':
continue
Expand Down Expand Up @@ -274,7 +276,15 @@ class PoemReader(ProfileReader):
for server in servers:
profileList.extend(self.createProfileEntries(server, ngi, validProfiles[profile.upper()]))

return profileList
for profile in validProfiles.values():
for metric in profile['metrics']:
profileListAvro.append({'profile' : profile['namespace'] + '.' + profile['name'], \
'metric' : metric['name'], \
'service' : metric['service_flavour'], \
'vo' : profile['vo'], \
'fqan' : metric['fqan']})

return profileList, profileListAvro

def loadFilteredProfiles(self):

Expand Down Expand Up @@ -503,23 +513,19 @@ config = loadConfiguration()
customers, customersdir = loadCustomerConfiguration()

# read profiles
profiles = list()
for reader in readers:
if reader == 'poem':
readerInstance = PoemReader()
readerInstance.loadConfiguration(config)
ps = readerInstance.getProfiles()
profiles.extend(ps)
ps, psa = readerInstance.getProfiles()

# write profiles
for writer in writers:
if writer == 'file':
writerInstance = FileWritter()
writerInstance.loadConfiguration(config)
writerInstance.writeProfiles(profiles, date)
elif writer == 'avro':
writerInstance.writeProfiles(ps, date)
elif writer == 'avro' and customers:
writerInstance = AvroWritter()
writerInstance.loadConfiguration(config)
writerInstance.writeProfiles(profiles, date)
if customers:
writerInstance.writeProfilesForCustomers(customers, customersdir, profiles, date)
writerInstance.writeProfilesForCustomers(customers, customersdir, psa, date)
8 changes: 4 additions & 4 deletions bin/prefilter-avro
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ checkInputFileForDays = 1
##############################
# load config
##############################
def loadConfiguration(confile):
def loadConfiguration():
#load config
configFile = None
configFields = dict()
if os.path.isfile(confile):
configFile = open(confile, 'r')
if os.path.isfile(defaultConfig):
configFile = open(defaultConfig, 'r')
lines = configFile.readlines()

for line in lines:
Expand Down Expand Up @@ -370,7 +370,7 @@ if not argsOk:
sys.exit()

#load config
loadConfiguration(configFile)
loadConfiguration()

# load poem data
ngis = loadNGIs(year, month, day)
Expand Down
4 changes: 4 additions & 0 deletions bin/topology-sync
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ from avro.io import DatumWriter

defaultConfig = '/etc/ar-sync/topology-sync.conf'

LegMapServType = {'SRM' : 'SRMv2'}
SelectGG = dict()
SelectGE = dict()
FetchType = ''
Expand Down Expand Up @@ -454,6 +455,9 @@ class AvroWritter(TopologyWriter):

for g in groupofendpoints:
writer.append(g)
if g['service'] in LegMapServType.keys():
g['service'] = LegMapServType[g['service']]
writer.append(g)

writer.close()
avroFile.close()
Expand Down
24 changes: 0 additions & 24 deletions etc/ar-sync/prefilter-avro.EGI.Cloudmon.conf

This file was deleted.

24 changes: 0 additions & 24 deletions etc/ar-sync/prefilter-avro.EGI.Critical.conf

This file was deleted.

0 comments on commit 57131ff

Please sign in to comment.