Ejemplo n.º 1
0
 def __enter__(self):
     print "entering publish"
     addr = "tcp://" + str(get_own_ip()) + ":" + str(self._port)
     self._broadcaster = sendaddresstype(self._name, addr,
                                         self._data_types,
                                         self._broadcast_interval).start()
     pub_addr = "tcp://*:" + str(self._port)
     self._publisher = Publisher(pub_addr)
     return self._publisher
Ejemplo n.º 2
0
            "filename": base,
            "URIs": ["file://"+fil],
            "type": "HRPT 1b",
            "format": "EPS 1b",
            "time_of_first_scanline": datetime.strptime(base[16:30],
                                                        "%Y%m%d%H%M%S").isoformat(),
            "time_of_last_scanline": datetime.strptime(base[32:46],
                                                        "%Y%m%d%H%M%S").isoformat()}
        import pprint
        pprint.pprint(metadata)
        yield Message('/dc/polar/gds', 'file', metadata)



PUB_ADDRESS = "tcp://" + str(get_own_ip()) + ":9000"
BROADCASTER = sendaddresstype('p1', PUB_ADDRESS, "HRPT 1b", 2).start()

time.sleep(10)

PUB = Publisher(PUB_ADDRESS)

try:
    #for msg in SUB(timeout=1):
    #    print "Consumer got", msg
    counter = 0
    while True:
        counter += 1
        for i in send_new_files():
            print "publishing " + str(i)
            PUB.send(str(i))
        time.sleep(60)
Ejemplo n.º 3
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
"""

from datetime import datetime
from posttroll.message import Message
from posttroll.publisher import Publisher, get_own_ip
from posttroll.message_broadcaster import sendaddresstype
import time

PUB_ADDRESS = "tcp://" + str(get_own_ip()) + ":9005"
BROADCASTER = sendaddresstype('dummy_datasource', PUB_ADDRESS, "NWP",
                              2).start()

PUB = Publisher(PUB_ADDRESS)

oper
test
dev
db
"""
/oper/polar/direct_readout/norrköping
/oper/polar/regional/kangerlusuaq
/oper/geo/0deg
/oper/geo/rss
/oper/geo/iodc
/oper/geo/iodc
"""
Ejemplo n.º 4
0
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
"""

from datetime import datetime
from posttroll.message import Message
from posttroll.publisher import Publisher, get_own_ip
from posttroll.message_broadcaster import sendaddresstype
import time

PUB_ADDRESS = "tcp://" + str(get_own_ip()) + ":9005"
BROADCASTER = sendaddresstype('dummy_datasource', PUB_ADDRESS, "NWP", 2).start()

PUB = Publisher(PUB_ADDRESS)

oper
test
dev
db

"""
/oper/polar/direct_readout/norrköping
/oper/polar/regional/kangerlusuaq
/oper/geo/0deg
/oper/geo/rss
/oper/geo/iodc
/oper/geo/iodc
Ejemplo n.º 5
0
        metadata = {
            "filename": base,
            "URIs": ["file://" + fil],
            "type": "HRPT 1b",
            "format": "EPS 1b",
            "time_of_first_scanline": datetime.strptime(base[16:30], "%Y%m%d%H%M%S").isoformat(),
            "time_of_last_scanline": datetime.strptime(base[32:46], "%Y%m%d%H%M%S").isoformat(),
        }
        import pprint

        pprint.pprint(metadata)
        yield Message("/dc/polar/gds", "file", metadata)


PUB_ADDRESS = "tcp://" + str(get_own_ip()) + ":9000"
BROADCASTER = sendaddresstype("p1", PUB_ADDRESS, "HRPT 1b", 2).start()

time.sleep(10)

PUB = Publisher(PUB_ADDRESS)

try:
    # for msg in SUB(timeout=1):
    #    print "Consumer got", msg
    counter = 0
    while True:
        counter += 1
        for i in send_new_files():
            print "publishing " + str(i)
            PUB.send(str(i))
        time.sleep(60)