Home > OS >  AttributeError: 'ChangeDetectorService' object has no attribute 'process'
AttributeError: 'ChangeDetectorService' object has no attribute 'process'

Time:10-04

I'm trying to develop Job program which in turn calls Service program. ChangeDetectorService does have procedure named process. I don't know why I get the warning message:

AttributeError: 'ChangeDetectorService' object has no attribute 'process'

"change_detector_job.py" and ChangeDetectorService source code are attached.

# change_detector_job.py

import argparse
import datetime
# import multiprocessing
import os
# import sys
# import traceback
import sys
import traceback

from common.utils.config import Config, log_start, log_end
from ReplicationService.module.ChangeDetectorService import ChangeDetectorService

args = None
main_config = None
main_logger = None
app_name = os.path.basename(sys.argv[0]).replace('.py', '')   '_main'


class ChangeDetectorJob:
    def __init__(self):
        self.config = None
        self.logger = None
        self.env = 'test'

    def setup(self):
        self.env = args.env
        self.config = Config(args.config, app_name)
        self.logger = self.config.get_logger()

    def process(self):
        self.setup()

        t1 = log_start("ChangeDetector job started (UTC): %s" % (datetime.datetime.utcnow()), with_memory=True,
                       logger=self.logger)
        service = ChangeDetectorService(args.config, app_name)
        success = service.process()
        log_end("ChangeDetector job completed (UTC): %s" % (datetime.datetime.utcnow()), success=success, start_time=t1,
                logger=self.logger)
if __name__ == '__main__':
    try:
        parser = argparse.ArgumentParser(description="Data ChangeDetector Job")
        parser.add_argument("-e", "--env", default="test", choices=['test', 'dev', 'uat', 'prd'],
                            help="environment this job to be deployed (default            
  • Related