Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

added careful copy job with corresponding test. #424

Merged
merged 2 commits into from
Nov 7, 2018

Conversation

ManInFez
Copy link
Contributor

@ManInFez ManInFez commented Nov 6, 2018

Task
#416

Approach
Short description of the approach

Pre un-WIP checklist

  • Statoil tests pass locally
  • Have completed graphical integration test steps

Depends on

  • Statoil/libecl#

@ghost
Copy link

ghost commented Nov 6, 2018

Can one of the admins verify this patch?

@joakim-hove
Copy link
Contributor

Ok to test

Copy link
Contributor

@joakim-hove joakim-hove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes - then she goes in. Good

@staticmethod
def carefulCopyFile(src , target = None):
if os.path.exists(target):
raise IOError("Input argument:'%s' already exist" % target)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the target file exists is perfectly OK - not exception.

@staticmethod
def carefulCopyFile(src , target = None):
if os.path.exists(target):
raise IOError("Input argument:'%s' already exist" % target)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the target file exists is perfectly OK - not exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the function fail silently? Would it not be a good idea to let the user know if the copy failed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well - if the file is already present the copy should not proceed, and that is the expected operation of this function - i.e. not a failure. Could add a message like:

print("File: {} already present - not updated".format(target_file))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, I will change it accordingly.

@@ -0,0 +1,9 @@
STDOUT careful_copy_file.stdout
STDERR careful_copy_file.stderr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std file descriptors are redirected by default - not necessary to do it explicitly.

Printing warning when file exist

Changed unit test of careful_copy_file accordingly
@joakim-hove joakim-hove merged commit 50dc7c8 into equinor:master Nov 7, 2018
@ManInFez ManInFez deleted the carefulCopyFile branch May 20, 2019 10:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants