-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Favors reading the INFO file if present to be able to have the most accurate version of Metaflow when executing remotely (especially in the presence of extensions). Also limit reading the INFO file to once per process (as opposed to possibly twice). Finally, gets the version of the source of Metaflow (and not the current directory)
- Loading branch information
1 parent
05521ff
commit 2201f4e
Showing
7 changed files
with
133 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
|
||
from os import path | ||
|
||
CURRENT_DIRECTORY = path.dirname(path.abspath(__file__)) | ||
INFO_FILE = path.join(path.dirname(CURRENT_DIRECTORY), "INFO") | ||
|
||
_info_file_content = None | ||
_info_file_present = None | ||
|
||
|
||
def read_info_file(): | ||
global _info_file_content | ||
global _info_file_present | ||
if _info_file_present is None: | ||
_info_file_present = path.exists(INFO_FILE) | ||
if _info_file_present: | ||
try: | ||
with open(INFO_FILE, "r", encoding="utf-8") as contents: | ||
_info_file_content = json.load(contents) | ||
except IOError: | ||
pass | ||
if _info_file_present: | ||
return _info_file_content | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters