Commit 82912d87 authored by Rafael Monnerat's avatar Rafael Monnerat

promise.is_process_older_than_dependency_set: Verbose a bit of information when fail.

parent 9bfb67ca
...@@ -12,7 +12,7 @@ import sys ...@@ -12,7 +12,7 @@ import sys
import os import os
import errno import errno
import argparse import argparse
import time
import psutil import psutil
ignored_extension_set = set([".pyc"]) ignored_extension_set = set([".pyc"])
...@@ -29,6 +29,10 @@ def moduleIsModifiedSince(top, since, followlinks=False): ...@@ -29,6 +29,10 @@ def moduleIsModifiedSince(top, since, followlinks=False):
if ext in ignored_extension_set: if ext in ignored_extension_set:
continue continue
if since < os.stat(os.path.join(root, name)).st_mtime: if since < os.stat(os.path.join(root, name)).st_mtime:
print "%s was modified since the process started." % \
os.path.join(root, name)
print "Process Time %s < Last modidified file %s" % (time.ctime(since),
time.ctime(os.stat(os.path.join(root, name)).st_mtime))
return True return True
return False return False
...@@ -37,6 +41,7 @@ def isProcessOlderThanDependencySet(pid, python_path_list, kill=False): ...@@ -37,6 +41,7 @@ def isProcessOlderThanDependencySet(pid, python_path_list, kill=False):
start_time = process.create_time() start_time = process.create_time()
if any(moduleIsModifiedSince(product_path, start_time) for product_path in python_path_list): if any(moduleIsModifiedSince(product_path, start_time) for product_path in python_path_list):
if kill: if kill:
print "Terminating process %s with pid %s" % (process.name(), pid)
process.terminate() process.terminate()
return True return True
return False return False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment