Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/celery/celery_tasks_states
82 82
	except IOError:
83 83
		print 'Could not connect to the celerymon webserver'
84 84
		sys.exit(-1)
85
		
85

  
86 86
def check_web_server_status(api_url):
87 87
	try:
88 88
		request = urllib.urlopen(api_url)
......
115 115
# Values
116 116
def print_values(workers = None, api_url = None):
117 117
	data = get_data('tasks', api_url)
118
	
118

  
119 119
	counters = dict([(key, 0) for key in TASK_STATES])
120 120
	for task_name, task_data in data:
121 121
		state = task_data['state']
122 122
		hostname = task_data['worker']['hostname']
123
		
123

  
124 124
		if workers and hostname not in workers:
125 125
			continue
126
		
126

  
127 127
		counters[state] += 1
128
			
128

  
129 129
	for name in TASK_STATES:
130 130
		name_cleaned = clean_state_name(name)
131 131
		value = counters[name]
132 132
		print '%s.value %d' % (name_cleaned, value)
133
		
133

  
134 134
if __name__ == '__main__':
135 135
	workers = os.environ.get('workers', 'all')
136 136
	api_url = os.environ.get('api_url', API_URL)
137
	
137

  
138 138
	check_web_server_status(api_url)
139
	
139

  
140 140
	if workers in [None, '', 'all']:
141 141
		workers = None
142 142
	else:
143 143
		workers = workers.split(',')
144
			
144

  
145 145
	if len(sys.argv) > 1:
146 146
		if sys.argv[1] == 'config':
147 147
			print_config(workers)
......
149 149
			print 'yes'
150 150
	else:
151 151
		print_values(workers, api_url)
152
		
152

  

Formats disponibles : Unified diff