Skip to content

Commit

Permalink
Merge pull request #100 from bourque/set-permissions-verbose-option
Browse files Browse the repository at this point in the history
Change default verbose option for set_permissions
  • Loading branch information
bourque authored Jun 22, 2018
2 parents a13e61b + e0867a0 commit 719f769
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jwql/dbmonitor/dbmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ def jwst_inventory(instruments=JWST_INSTRUMENTS,
outfile = os.path.join(get_config()['outputs'], 'database_monitor', output_filename)
output_file(outfile)
save(plt)
set_permissions(outfile, verbose=False)
set_permissions(outfile)

return table, keywords
2 changes: 1 addition & 1 deletion jwql/logging/logging_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def configure_logging(module, production_mode=True, path='./'):
format='%(asctime)s %(levelname)s: %(message)s',
datefmt='%m/%d/%Y %H:%M:%S %p',
level=logging.INFO)
set_permissions(log_file, verbose=False)
set_permissions(log_file)


def make_log_file(module, production_mode=True, path='./'):
Expand Down
8 changes: 4 additions & 4 deletions jwql/monitor_filesystem/monitor_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ def filesystem_monitor():
with open(statsfile, "a+") as f:
f.write("{0} {1:15d} {2:15d} {3:15d} {4:15d} {5}\n".format(now, results_dict['file_count'],
total, available, used, percent_used))
set_permissions(statsfile, verbose=False)
set_permissions(statsfile)

# set up and read out stats on files by type
filesbytype = os.path.join(outputs_dir, 'filesbytype.txt')
with open(filesbytype, "a+") as f2:
f2.write("{0} {1} {2} {3} {4} {5}\n".format(results_dict['fits_files'],
results_dict['uncal'], results_dict['cal'], results_dict['rate'],
results_dict['rateints'], results_dict['i2d']))
set_permissions(filesbytype, verbose=False)
set_permissions(filesbytype)

# set up file size by type file
sizebytype = os.path.join(outputs_dir, 'sizebytype.txt')
with open(sizebytype, "a+") as f3:
f3.write("{0} {1} {2} {3} {4} {5}\n".format(size_dict['size_fits'],
size_dict['uncal'], size_dict['cal'], size_dict['rate'],
size_dict['rateints'], size_dict['i2d']))
set_permissions(sizebytype, verbose=False)
set_permissions(sizebytype)


def plot_system_stats(stats_file, filebytype, sizebytype):
Expand Down Expand Up @@ -235,7 +235,7 @@ def plot_system_stats(stats_file, filebytype, sizebytype):
outfile = os.path.join(outputs_dir, "filesystem_monitor.html")
output_file(outfile)
save(grid)
set_permissions(outfile, verbose=False)
set_permissions(outfile)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion jwql/permissions/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def has_permissions(pathname, owner=DEFAULT_OWNER, mode=DEFAULT_MODE, group=DEFA
return True


def set_permissions(pathname, owner=DEFAULT_OWNER, mode=DEFAULT_MODE, group=DEFAULT_GROUP, verbose=True):
def set_permissions(pathname, owner=DEFAULT_OWNER, mode=DEFAULT_MODE, group=DEFAULT_GROUP, verbose=False):
"""Set mode and group of the file/directory identfied by
``pathname``, if and only if it is owned by ``owner``.
Expand Down
4 changes: 2 additions & 2 deletions jwql/preview_image/generate_preview_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def generate_preview_images():
# Create the output directories if necessary
if not os.path.exists(output_directory):
os.makedirs(output_directory)
permissions.set_permissions(output_directory, verbose=False)
permissions.set_permissions(output_directory)
if not os.path.exists(thumbnail_output_directory):
os.makedirs(thumbnail_output_directory)
permissions.set_permissions(thumbnail_output_directory, verbose=False)
permissions.set_permissions(thumbnail_output_directory)

# Create and save the preview image and thumbnail
args = zip((False, True), (output_directory, thumbnail_output_directory))
Expand Down
2 changes: 1 addition & 1 deletion jwql/preview_image/preview_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def save_image(self, outfile):
"""

plt.savefig(outfile, bbox_inches='tight', pad_inches=0)
permissions.set_permissions(outfile, verbose=False)
permissions.set_permissions(outfile)

# If the image is a thumbnail, rename to '.thumb'
if self.thumbnail:
Expand Down

0 comments on commit 719f769

Please sign in to comment.