-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
169 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from .logresponse import LogResponse | ||
|
||
__all__ = ['CreateRebuildIndexResponse', 'GetRebuildIndexResponse'] | ||
|
||
|
||
class CreateRebuildIndexResponse(LogResponse): | ||
""" Response of create_rebuild_index | ||
:type resp: dict | ||
:param resp: CreateRebuildIndexResponse HTTP response body | ||
:type header: dict | ||
:param header: CreateRebuildIndexResponse HTTP response header | ||
""" | ||
|
||
def __init__(self, header, resp): | ||
LogResponse.__init__(self, header, resp) | ||
|
||
def log_print(self): | ||
print('CreateRebuildIndexResponse:') | ||
print('headers:', self.get_all_headers()) | ||
|
||
|
||
class GetRebuildIndexResponse(LogResponse): | ||
""" The response of the get_rebuild_index. | ||
:type resp: dict | ||
:param resp: GetRebuildIndexResponse HTTP response body | ||
:type header: dict | ||
:param header: GetRebuildIndexResponse HTTP response header | ||
""" | ||
|
||
def __init__(self, header, resp): | ||
LogResponse.__init__(self, header, resp) | ||
self._status = resp['status'] | ||
self._execution_details = resp.get('executionDetails') | ||
self._configuration = resp['configuration'] | ||
|
||
def get_status(self): | ||
"""job status | ||
""" | ||
return self._status | ||
|
||
def get_execution_details(self): | ||
"""job execution details | ||
""" | ||
return self._execution_details | ||
|
||
def get_configuration(self): | ||
"""job configuration | ||
""" | ||
return self._configuration | ||
|
||
def log_print(self): | ||
print('GetRebuildIndexResponse:') | ||
print('headers:', self.get_all_headers()) | ||
print('status: ', self.get_status()) | ||
print('execution_details: ', self.get_execution_details()) | ||
print('configuration: ', self.get_configuration()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = '0.9.13rc1' | ||
__version__ = '0.9.13' | ||
|
||
import sys | ||
OS_VERSION = str(sys.platform) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import time | ||
from aliyun.log import LogClient | ||
|
||
|
||
def main(): | ||
client = LogClient("cn-hangzhou.log.aliyuncs.com", | ||
"your_access_key_id", "your_access_key_secret") | ||
|
||
# replace with an unique job_name here | ||
job_name = 'test-rebuild-index-test-1' | ||
|
||
project = 'your_project' | ||
logstore = 'your_logstore' | ||
|
||
# to_time must <= now - 900 | ||
to_time = int(time.time()) - 900 | ||
from_time = to_time - 3600 | ||
display_name = "this is create rebuild index test job" | ||
client.create_rebuild_index(project, | ||
logstore, | ||
job_name, | ||
display_name, | ||
from_time, | ||
to_time) | ||
|
||
# wait a while util job complete | ||
while True: | ||
print('wait rebuild index done...') | ||
time.sleep(10) | ||
resp = client.get_rebuild_index(project, job_name) | ||
resp.log_print() | ||
|
||
if resp.get_status() == 'SUCCEEDED': | ||
print('rebuild index succeed') | ||
break | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |