|
- # import sys
- # sys.path.extend(["..", "../util"])
- # from util.AliyunSdk import AliyunVodSdk
- # from concurrency.CommonThread import Common
- from kafka import KafkaProducer
- import json
- import threading
-
- topicName = 'dsp-alg-online-tasks'
- eBody = {
- "request_id": "d4c909912ac741ce81ccef03fd1b2ec45",
- "models": [
- {
- "code": "001",
- "categories": [{
- "id": "0",
- "config": {}
- },
- {
- "id": "1",
- "config": {}
- },
- {
- "id": "2",
- "config": {}
- },
- {
- "id": "3",
- "config": {}
- },
- {
- "id": "4",
- "config": {}
- },
- {
- "id": "5",
- "config": {}
- }
- ]
- }],
- "command": "start",
- "pull_url": "rtmp://live.play.t-aaron.com/live/THSAr",
- "push_url": "rtmp://live.push.t-aaron.com/live/THSAs",
- "results_base_dir": "P20220802133841159"
- }
- producer = KafkaProducer(bootstrap_servers=['192.168.11.242:9092'],
- value_serializer=lambda m: json.dumps(m).encode('utf-8'))
- future = producer.send(topicName, key=b'd4c909912ac741ce81ccef03fd1b2ec45', value=eBody)
- result = future.get(timeout=10)
- print(result)
-
- # topicName = 'dsp-alg-image-tasks'
- # eBody = {
- # "request_id": "d4c909912ac741ce81ccef03fd1b2ec46",
- # "models": [
- # {
- # "code": "001",
- # "categories": [
- # {
- # "id": "0",
- # "config": {}
- # },
- # {
- # "id": "1",
- # "config": {}
- # },
- # {
- # "id": "2",
- # "config": {}
- # },
- # {
- # "id": "3",
- # "config": {}
- # },
- # {
- # "id": "4",
- # "config": {}
- # },
- # {
- # "id": "5",
- # "config": {}
- # },
- # {
- # "id": "6",
- # "config": {}
- # },
- # {
- # "id": "7",
- # "config": {}
- # }
- # ]
- # }],
- # "command": "start",
- # "image_urls": ["https://image.t-aaron.com/P20221112103326614/2022-11-12-10-37-02_frame-3991-4291_20221112103702452021-offline-P20221112103326614-eb4467a3fe8f405ebf4c44f1b48a7e4b_OR.jpg",
- # "https://image.t-aaron.com/P20221112103326614/2022-11-12-10-35-09_frame-1785-2085_20221112103509952824-offline-P20221112103326614-eb4467a3fe8f405ebf4c44f1b48a7e4b_OR.jpg"],
- # "results_base_dir": "P20220802133841159"
- # }
- # topicName = 'dsp-alg-offline-tasks'
- # eBody = {
- # "request_id": "d4c909912ac741ce81ccef03fd1b2ec46",
- # "models": [
- # {
- # "code": "001",
- # "categories": [
- # {
- # "id": "0",
- # "config": {}
- # },
- # {
- # "id": "1",
- # "config": {}
- # },
- # {
- # "id": "2",
- # "config": {}
- # },
- # {
- # "id": "3",
- # "config": {}
- # },
- # {
- # "id": "4",
- # "config": {}
- # },
- # {
- # "id": "5",
- # "config": {}
- # },
- # {
- # "id": "6",
- # "config": {}
- # },
- # {
- # "id": "7",
- # "config": {}
- # }
- # ]
- # }],
- # "command": "start",
- # "original_url": "https://vod.play.t-aaron.com/0bc905ef5651439da2bfba8427fe467e/a76a7ebb6e3b44ef9c0c7820c7e9c574-f2d7ee90cba11aa91971d58e06d295d2-4k.mp4",
- # "original_type": ".mp4",
- # "push_url": "rtmp://live.push.t-aaron.com/live/THSAr",
- # "results_base_dir": "P20220802133841159"
- # }
- # producer = KafkaProducer(bootstrap_servers=['192.168.11.13:9092'],
- # value_serializer=lambda m: json.dumps(m).encode('utf-8'))
- # future = producer.send(topicName, key=b'd4c909912ac741ce81ccef03fd1b2ec46', value=eBody)
- # result = future.get(timeout=10)
- # print(result)
|