Exemplo n.º 1
0
    def setUp(self):
        self.project = os.environ[MaxComputeConfig.PROJECT_NAME]
        access_id = os.environ[MaxComputeConfig.ACCESS_ID]
        access_key = os.environ[MaxComputeConfig.ACCESS_KEY]
        endpoint = os.environ.get(MaxComputeConfig.ENDPOINT)
        tunnel_endpoint = os.environ.get(MaxComputeConfig.TUNNEL_ENDPOINT,
                                         None)
        self.test_table = "test_odps_data_reader_%d_%d" % (
            int(time.time()),
            random.randint(1, 101),
        )
        self.odps_client = ODPS(access_id, access_key, self.project, endpoint)
        create_iris_odps_table(self.odps_client, self.project, self.test_table)
        self.records_per_task = 50

        self.reader = ODPSDataReader(
            project=self.project,
            access_id=access_id,
            access_key=access_key,
            endpoint=endpoint,
            table=self.test_table,
            tunnel_endpoint=tunnel_endpoint,
            num_processes=1,
            records_per_task=self.records_per_task,
        )
Exemplo n.º 2
0
 def setUp(self):
     self._project = os.environ[ODPSConfig.PROJECT_NAME]
     self._access_id = os.environ[ODPSConfig.ACCESS_ID]
     self._access_key = os.environ[ODPSConfig.ACCESS_KEY]
     self._endpoint = os.environ.get(ODPSConfig.ENDPOINT)
     self._test_read_table = "test_odps_reader_%d_%d" % (
         int(time.time()),
         random.randint(1, 101),
     )
     self._test_write_table = "test_odps_writer_%d_%d" % (
         int(time.time()),
         random.randint(1, 101),
     )
     self._odps_client = ODPS(self._access_id, self._access_key,
                              self._project, self._endpoint)
     create_iris_odps_table(self._odps_client, self._project,
                            self._test_read_table)