diff options
author | makkalot <makkalot@gmail.com> | 2008-08-03 00:12:11 +0300 |
---|---|---|
committer | makkalot <makkalot@gmail.com> | 2008-08-03 00:12:11 +0300 |
commit | 8e8560dcb4d9e796156df8bfaad6564a555e2724 (patch) | |
tree | cb395135d194c9228203ee337a1fee097e41c5b0 /func/utils.py | |
parent | 085dc1cf3a1387cf6bc361b0a0a93e0d63df1ecf (diff) | |
download | func-8e8560dcb4d9e796156df8bfaad6564a555e2724.tar.gz func-8e8560dcb4d9e796156df8bfaad6564a555e2724.tar.xz func-8e8560dcb4d9e796156df8bfaad6564a555e2724.zip |
fix for jobthing to tolerate the weird and long names for globs in database related with async job_ids
Diffstat (limited to 'func/utils.py')
-rwxr-xr-x | func/utils.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/func/utils.py b/func/utils.py index 0e4b4d5..628694d 100755 --- a/func/utils.py +++ b/func/utils.py @@ -29,4 +29,26 @@ def is_error(result): return False - +def remove_weird_chars(dirty_word): + """ + That method will be used to clean some + glob adress expressions because async stuff + depends on that part + + @param dirty_word : word to be cleaned + """ + from copy import copy + copy_word = copy(dirty_word) + copy_word = copy_word.replace("-","_") + return copy_word + +def get_formated_jobid(**id_pack): + import time + import pprint + + glob = remove_weird_chars(id_pack['spec']) + module = remove_weird_chars(id_pack['module']) + method = remove_weird_chars(id_pack['method']) + job_id = "".join([glob,"-",module,"-",method,"-",pprint.pformat(time.time())]) + return job_id + |