renyupeng 3 years ago
parent
commit
684679d830
1 changed files with 8 additions and 5 deletions
  1. 8 5
      monitor/ApplicationCDCMonitor.py

+ 8 - 5
monitor/ApplicationCDCMonitor.py

@@ -28,16 +28,19 @@ class ApplicationCDCMonitor:
         headers = {'Content-Type': 'application/json'}
         repo = requests.get(url='http://{}:{}{}?'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url),
                             headers=headers)
-        errrepo = requests.get(url='http://{}:{}{}?state=error'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url),
-                               headers=headers)
+        errrepo = requests.get(
+            url='http://{}:{}{}?state=error'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url),
+            headers=headers)
         errtask = errrepo.json()
         if errtask is not None:
+            errtask_id = errtask['id']
+            print(errtask, '-----error--------')
             os.system(
                 'cd /data/tidb-deploy/cdc-8300/bin; ./cdc cli changefeed create --pd=http://192.168.0.184:2379 '
                 '--sink-uri="mysql://data:hcst@2021@139.186.27.96:3390" --config ../conf/{task_id}.toml '
-                '--changefeed-id={task_id} '.format(task_id=errtask['id']))
+                '--changefeed-id={task_id} '.format(task_id=errtask_id))
         message = repo.json()
-        #print(message)
+        # print(message)
         for json in message:
             task_id = json['id']
             tso = json['checkpoint_tso']
@@ -50,7 +53,7 @@ class ApplicationCDCMonitor:
                     'cd /data/tidb-deploy/cdc-8300/bin; ./cdc cli changefeed create --pd=http://192.168.0.184:2379 '
                     '--sink-uri="mysql://data:hcst@2021@139.186.27.96:3390" --config ../conf/{task_id}.toml '
                     '--changefeed-id={task_id} --start-ts {tso}'.format(tso=tso, task_id=task_id))
-                #print(status)
+                # print(status)
 
                 backResult = requests.get(
                     url='http://{}:{}{}/{}'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url, task_id),