-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/cwd flag closes #1160 #1161
Conversation
Hi @dimidagd ! I think this is a good change, but can you please make some changes such that the section you changed is a bit clearer? It's a bit hard to follow. You could add some comments that exemplifies what is going on in this section. Also, looks like there are some conflicts, can you resolve those please? |
@dimidagd any update on this? |
Would you like some comments on the actual code changes?
[image: photo]
|
@dimidagd yes, the section itself (even excluding the changes) is a bit hard to read. Can you please add a few comments that could make it a bit easier to follow? |
@@ -218,15 +215,14 @@ def create_task(self, dry_run=False): | |||
task_state['script']['requirements'] = repo_info.script.get('requirements') or {} | |||
if self.cwd: | |||
self.cwd = self.cwd | |||
cwd = self.cwd if Path(self.cwd).is_dir() else ( | |||
Path(repo_info.script['repo_root']) / self.cwd).as_posix() | |||
cwd = ( Path(repo_info.script['repo_root']) / self.cwd).as_posix() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize only to to absolute path
entry_point = \ | ||
Path(repo_info.script['repo_root']) / repo_info.script['working_dir'] / repo_info.script[ | ||
'entry_point'] | ||
entry_point = entry_point.relative_to(cwd).as_posix() | ||
cwd = Path(cwd).relative_to(repo_info.script['repo_root']).as_posix() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cwd can be replaced with relative path 'to cwd from entry_point '
if not Path(cwd).is_dir(): | ||
raise ValueError("Working directory \'{}\' could not be found".format(cwd)) | ||
cwd = Path(cwd).relative_to(repo_info.script['repo_root']).as_posix() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move cwd override by relative path later on, because entry_point has to be resolved
Have added comments now. |
@dimidagd it seems there are conflicts - can you please resolve them? |
closes #1160 # A bug was preventing the use of --cwd and --folder. More specifically a function call to Path(path1).relative_to(path2) , where path1 has been stripped of the trailing directories, resulted in a specific exception being raised.
How to test fix
Given a tree structure
Running
clearml-task --project testing --name test_run --script notebooks/run_clearml.py --task-type testing --folder $PWD --queue default --cwd notebooks
Expected behaviour