Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/mintproject/mic
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarijo committed Oct 26, 2020
2 parents 29ee831 + 11972aa commit 89cffdb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 21 deletions.
63 changes: 56 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Changelog

## [1.3.4](https://github.com/mintproject/mic/tree/1.3.4) (2020-09-15)

[Full Changelog](https://github.com/mintproject/mic/compare/1.3.3...1.3.4)

**Implemented enhancements:**

- mintproject/generic:latest is not up to date [\#287](https://github.com/mintproject/mic/issues/287)

**Fixed bugs:**

- files with hyphen in yaml causes issues with run [\#293](https://github.com/mintproject/mic/issues/293)
- Param auto detector will detect "multiple words in quotes" as several parameters [\#290](https://github.com/mintproject/mic/issues/290)
- String parameters in commands fail in components due to extra quotes. [\#288](https://github.com/mintproject/mic/issues/288)

**Merged pull requests:**

- Executables file [\#304](https://github.com/mintproject/mic/pull/304) ([mosoriob](https://github.com/mosoriob))
- Fix: inputs bug for SWAT model [\#303](https://github.com/mintproject/mic/pull/303) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Fix: start thinks mic dir exists every time [\#297](https://github.com/mintproject/mic/pull/297) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Fix: replace hyphens with underscore for yaml input direcory names [\#295](https://github.com/mintproject/mic/pull/295) ([Cmheidelberg](https://github.com/Cmheidelberg))

## [1.3.3](https://github.com/mintproject/mic/tree/1.3.3) (2020-08-03)

[Full Changelog](https://github.com/mintproject/mic/compare/1.3.2...1.3.3)

**Fixed bugs:**

- MIC is not working in WINDOWS [\#266](https://github.com/mintproject/mic/issues/266)

**Merged pull requests:**

- Develop [\#294](https://github.com/mintproject/mic/pull/294) ([mosoriob](https://github.com/mosoriob))
- Fix: use shlex instead of split by space to keep quoted strings [\#291](https://github.com/mintproject/mic/pull/291) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Windowsfix [\#281](https://github.com/mintproject/mic/pull/281) ([Cmheidelberg](https://github.com/Cmheidelberg))

## [1.3.2](https://github.com/mintproject/mic/tree/1.3.2) (2020-07-28)

[Full Changelog](https://github.com/mintproject/mic/compare/1.3.1...1.3.2)

**Fixed bugs:**

- start command fails with python [\#285](https://github.com/mintproject/mic/issues/285)

**Merged pull requests:**

- fix: convert CRLF to LF [\#286](https://github.com/mintproject/mic/pull/286) ([mosoriob](https://github.com/mosoriob))
- Windowsfix [\#283](https://github.com/mintproject/mic/pull/283) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Revert "Windowsfix" [\#282](https://github.com/mintproject/mic/pull/282) ([mosoriob](https://github.com/mosoriob))

## [1.3.1](https://github.com/mintproject/mic/tree/1.3.1) (2020-07-27)

[Full Changelog](https://github.com/mintproject/mic/compare/1.3.0...1.3.1)
Expand Down Expand Up @@ -42,6 +91,7 @@
- F\#266 [\#273](https://github.com/mintproject/mic/pull/273) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Testo [\#272](https://github.com/mintproject/mic/pull/272) ([mosoriob](https://github.com/mosoriob))
- Logging [\#271](https://github.com/mintproject/mic/pull/271) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Develop [\#270](https://github.com/mintproject/mic/pull/270) ([mosoriob](https://github.com/mosoriob))
- System packages [\#269](https://github.com/mintproject/mic/pull/269) ([mosoriob](https://github.com/mosoriob))
- Remove: mic model command [\#259](https://github.com/mintproject/mic/pull/259) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Auto params [\#258](https://github.com/mintproject/mic/pull/258) ([Cmheidelberg](https://github.com/Cmheidelberg))
Expand All @@ -59,7 +109,6 @@

**Merged pull requests:**

- Develop [\#270](https://github.com/mintproject/mic/pull/270) ([mosoriob](https://github.com/mosoriob))
- fix\(git\): force push a new repository [\#263](https://github.com/mintproject/mic/pull/263) ([mosoriob](https://github.com/mosoriob))
- F\#203 [\#253](https://github.com/mintproject/mic/pull/253) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Develop [\#251](https://github.com/mintproject/mic/pull/251) ([mosoriob](https://github.com/mosoriob))
Expand Down Expand Up @@ -102,7 +151,6 @@

- Develop [\#242](https://github.com/mintproject/mic/pull/242) ([mosoriob](https://github.com/mosoriob))
- Docs [\#241](https://github.com/mintproject/mic/pull/241) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Release new version 1.5.0 [\#240](https://github.com/mintproject/mic/pull/240) ([mosoriob](https://github.com/mosoriob))
- Release v1.5.0 [\#237](https://github.com/mintproject/mic/pull/237) ([mosoriob](https://github.com/mosoriob))
- Rename: publish command replaced with upload [\#236](https://github.com/mintproject/mic/pull/236) ([Cmheidelberg](https://github.com/Cmheidelberg))
- fix\(run\_line\): add quotes to string parameter [\#233](https://github.com/mintproject/mic/pull/233) ([mosoriob](https://github.com/mosoriob))
Expand Down Expand Up @@ -152,6 +200,7 @@

**Merged pull requests:**

- Release new version 1.5.0 [\#240](https://github.com/mintproject/mic/pull/240) ([mosoriob](https://github.com/mosoriob))
- Release v1.0.1 [\#232](https://github.com/mintproject/mic/pull/232) ([mosoriob](https://github.com/mosoriob))
- F\#185 [\#230](https://github.com/mintproject/mic/pull/230) ([Cmheidelberg](https://github.com/Cmheidelberg))
- F\#209 [\#229](https://github.com/mintproject/mic/pull/229) ([Cmheidelberg](https://github.com/Cmheidelberg))
Expand All @@ -160,7 +209,6 @@
- add yaml comments and improve detection of code [\#225](https://github.com/mintproject/mic/pull/225) ([mosoriob](https://github.com/mosoriob))
- \#223 fix: detect binary reprozip inside the default\_path as code\_file [\#224](https://github.com/mintproject/mic/pull/224) ([mosoriob](https://github.com/mosoriob))
- Yaml comments [\#221](https://github.com/mintproject/mic/pull/221) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Release v1.0.0 [\#220](https://github.com/mintproject/mic/pull/220) ([mosoriob](https://github.com/mosoriob))

## [1.0.0](https://github.com/mintproject/mic/tree/1.0.0) (2020-06-26)

Expand Down Expand Up @@ -217,6 +265,7 @@
**Merged pull requests:**

- release 1.0.0 [\#222](https://github.com/mintproject/mic/pull/222) ([mosoriob](https://github.com/mosoriob))
- Release v1.0.0 [\#220](https://github.com/mintproject/mic/pull/220) ([mosoriob](https://github.com/mosoriob))
- fix: pull and handle the conflicts [\#218](https://github.com/mintproject/mic/pull/218) ([mosoriob](https://github.com/mosoriob))
- fix: end message publish shows the url to edit it [\#213](https://github.com/mintproject/mic/pull/213) ([mosoriob](https://github.com/mosoriob))
- Yaml comments [\#206](https://github.com/mintproject/mic/pull/206) ([Cmheidelberg](https://github.com/Cmheidelberg))
Expand All @@ -232,7 +281,6 @@
- fix: Step6 crash if no inputs \#139 [\#150](https://github.com/mintproject/mic/pull/150) ([mosoriob](https://github.com/mosoriob))
- F\#139 [\#147](https://github.com/mintproject/mic/pull/147) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Add: output log for step6 [\#141](https://github.com/mintproject/mic/pull/141) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Fix: step7 removes temporary files [\#140](https://github.com/mintproject/mic/pull/140) ([Cmheidelberg](https://github.com/Cmheidelberg))

## [0.4.4](https://github.com/mintproject/mic/tree/0.4.4) (2020-06-08)

Expand All @@ -241,7 +289,6 @@
**Merged pull requests:**

- fix: tests [\#137](https://github.com/mintproject/mic/pull/137) ([mosoriob](https://github.com/mosoriob))
- Improved outputs [\#135](https://github.com/mintproject/mic/pull/135) ([Cmheidelberg](https://github.com/Cmheidelberg))

## [0.4.3](https://github.com/mintproject/mic/tree/0.4.3) (2020-06-05)

Expand Down Expand Up @@ -294,14 +341,18 @@
- Improve message step3 [\#115](https://github.com/mintproject/mic/issues/115)
- rename run file to `mic run file` [\#108](https://github.com/mintproject/mic/issues/108)
- rename `mic configuration file` to `mic file` [\#107](https://github.com/mintproject/mic/issues/107)
- rename command mic configure to mic credentials [\#105](https://github.com/mintproject/mic/issues/105)
- Documentation \[End of May\] [\#67](https://github.com/mintproject/mic/issues/67)
- Extend documentation in MIC with guidelines on good component design [\#62](https://github.com/mintproject/mic/issues/62)
- New feature: initialize docker image [\#58](https://github.com/mintproject/mic/issues/58)
- improve the text [\#3](https://github.com/mintproject/mic/issues/3)

**Merged pull requests:**

- Fix: step7 removes temporary files [\#140](https://github.com/mintproject/mic/pull/140) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Improved outputs [\#135](https://github.com/mintproject/mic/pull/135) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Detect dependencies [\#119](https://github.com/mintproject/mic/pull/119) ([mosoriob](https://github.com/mosoriob))
- Develop [\#117](https://github.com/mintproject/mic/pull/117) ([mosoriob](https://github.com/mosoriob))
- F\#107 108 [\#114](https://github.com/mintproject/mic/pull/114) ([Cmheidelberg](https://github.com/Cmheidelberg))
- Add version model [\#110](https://github.com/mintproject/mic/pull/110) ([mosoriob](https://github.com/mosoriob))
- Add version mdodel [\#104](https://github.com/mintproject/mic/pull/104) ([mosoriob](https://github.com/mosoriob))
Expand Down Expand Up @@ -330,13 +381,11 @@

- fix: compatibility between the mic and dame [\#109](https://github.com/mintproject/mic/issues/109)
- rename config.yaml to mic.yaml [\#106](https://github.com/mintproject/mic/issues/106)
- rename command mic configure to mic credentials [\#105](https://github.com/mintproject/mic/issues/105)
- step1 create .gitignore [\#98](https://github.com/mintproject/mic/issues/98)
- mic publish - git [\#77](https://github.com/mintproject/mic/issues/77)

**Merged pull requests:**

- Develop [\#117](https://github.com/mintproject/mic/pull/117) ([mosoriob](https://github.com/mosoriob))
- Develop [\#111](https://github.com/mintproject/mic/pull/111) ([mosoriob](https://github.com/mosoriob))

## [0.3.0](https://github.com/mintproject/mic/tree/0.3.0) (2020-05-07)
Expand Down
2 changes: 1 addition & 1 deletion src/mic/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.3"
__version__ = "1.3.4"
20 changes: 14 additions & 6 deletions src/mic/click_encapsulate/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ def start(user_execution_directory, name, image):
"""
user_execution_directory = Path(user_execution_directory)
mic_dir = user_execution_directory / MIC_DIR

create_base_directories(mic_dir)

# Cant log the start command until the mic dir has been created. Else mic will think the directory already exists
if make_log_file():
log_system_info(get_mic_logger().name)

log_command(logging, "start", name=name, image=image)

create_base_directories(mic_dir)
mic_config_path = create_config_file_yaml(mic_dir)
custom_image = False

Expand All @@ -94,16 +97,20 @@ def start(user_execution_directory, name, image):

render_dockerfile(mic_dir, framework)


# Make sure the name given is valid
if not name.islower():
logging.debug("User's model name does not contain all lowercase characters. Setting it to lower")
click.secho("Model name must be lower case. Mic will replace any uppercase letters",fg='yellow')
name = name.lower()

os.system(f"docker pull {framework.image}")
try:
user_image = build_docker(mic_dir / DOCKER_DIR, name)
except ValueError:
click.secho("The extraction of dependencies has failed", fg='red')
user_image = framework.image

conv_arr = recursive_convert_to_lf(mic_dir)
logging.debug("Converting any CRLF to LF: {}".format(conv_arr))

container_name = f"{name}_{str(uuid.uuid4())[:8]}"
write_spec(mic_config_path, NAME_KEY, name)
write_spec(mic_config_path, DOCKER_KEY, user_image)
Expand All @@ -114,9 +121,10 @@ def start(user_execution_directory, name, image):
docker_cmd = f"""docker run -ti \
--name={container_name} \
--cap-add=SYS_PTRACE \
-v {user_execution_directory}:/tmp/mint \
-v \"{user_execution_directory}\":/tmp/mint \
-w /tmp/mint {user_image} """


if custom_image:
click.secho(f"""
You are using a custom image
Expand Down Expand Up @@ -189,7 +197,7 @@ def trace(command, c, o):
status = reprozip.tracer.trace.trace(command[0], list(command), base_dir, append, 1)
if status != 0:
click.secho("Program exited with non-zero code", fg="red")
logging.warning("Reprozip tracer exited with non-zero code")
logging.warning("Reprozip tracer exited with non-zero code: {}".format(status))
reprozip.tracer.trace.write_configuration(base, identify_packages, identify_inputs_outputs, overwrite=False)

outputs = [str(i.absolute()) for i in detect_new_reprozip(Path("."), now)]
Expand Down
2 changes: 1 addition & 1 deletion src/mic/component/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def copy_file(input_path: Path, src_dir_path: Path):


def compress_directory(directory_path: Path, working_dir):
zip_file_path = shutil.make_archive(directory_path.name, 'zip', root_dir=directory_path.parent,
zip_file_path = shutil.make_archive(directory_path.name.replace("-","_"), 'zip', root_dir=directory_path.parent,
base_dir=directory_path.name)
data_zip = working_dir / Path(zip_file_path).name
shutil.move(zip_file_path, data_zip)
Expand Down
13 changes: 7 additions & 6 deletions src/mic/component/reprozip.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,16 @@ def find_code_files(spec, inputs, config_files, user_execution_directory):
logging.debug("Adding executable: {}".format(files_path.name))
return list(set(code_files))


def is_executable(file_path):

for i in EXECUTABLE_EXTENSIONS:
name = file_path.name.lower()
name = "." + (name.split("."))[1]
if i.lower() == name.lower():
return True
ext = os.path.splitext(file_path)[-1] # Only grab the extension
print(ext)
if ext.lower() in EXECUTABLE_EXTENSIONS:
return True
else:
return False

return False

def extract_parameters_from_command(command_line):
regex = r"(\"[^\"]+\"|[^\s\"]+)"
Expand Down

0 comments on commit 89cffdb

Please sign in to comment.