-
Notifications
You must be signed in to change notification settings - Fork 0
/
flush-queue.py
45 lines (37 loc) · 1.12 KB
/
flush-queue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
# -*- coding: UTF-8
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. */
# Authors:
# Michael Berg-Mohnicke <[email protected]>
# Tommaso Stella <[email protected]>
#
# Maintainers:
# Currently maintained by the authors.
#
# This file has been created at the Institute of
# Landscape Systems Analysis at the ZALF.
# Copyright (C: Leibniz Centre for Agricultural Landscape Research (ZALF)
import sys
#print sys.path
import zmq
#print "pyzmq version: ", zmq.pyzmq_version(), " zmq version: ", zmq.zmq_version()
config = {
"server": "login01.cluster.zalf.de",
"port": "7777"
}
if len(sys.argv) > 1:
for arg in sys.argv[1:]:
k, v = arg.split("=")
if k in config:
config[k] = v
context = zmq.Context()
socket = context.socket(zmq.PULL)
socket.connect("tcp://" + config["server"] + ":" + config["port"])
i = 0
while True:
socket.recv_json(encoding="latin-1")
if i%10 == 0:
print(i, end=" ", flush=True)
i = i + 1