Skip to content
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

Small update and bug fixing pre-release 2.0.0 #202

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,47 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2024-02-28 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.0.0
## [2.1.0dev] - 2024-0X-0X : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.1.X

### Credits

Code contributions to the hotfix:

### Template fixes and updates

### Modules

#### Added enhancements

#### Fixes

#### Changed

#### Removed

### Requirements

## [2.X.1hot] - 2024-0X-0X : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.X.1

### Credits

Code contributions to the hotfix:

### Template fixes and updates

### Modules

#### Added enhancements

#### Fixes

#### Changed

#### Removed

### Requirements

## [2.0.0] - 2024-03-01 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.0.0

### Credits

Expand All @@ -31,6 +71,8 @@ Code contributions to the release:
- Added finish module
- Added json files: sftp_user.json
- Added delivery jinja templates
- Added IRMA template to services.json
- Scratch module now executes rsync using SLURM's srun

#### Fixes

Expand Down
4 changes: 2 additions & 2 deletions bu_isciii/conf/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
},
"xtutatis_api_settings": {
"api_url": "/drylab/api/",
"server": "http://iskylims.isciiides.es"
"server": "https://iskylims.isciii.es"
},
"api_settings": {
"server": "http://iskylims.isciiides.es",
"server": "https://iskylims.isciii.es",
"api_url": "/drylab/api/"
},
"bioinfo_doc": {
Expand Down
42 changes: 22 additions & 20 deletions bu_isciii/scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def __init__(
"resolution_full_number"
]
self.scratch_tmp_path = os.path.join(self.tmp_dir, self.service_folder)
self.out_file = os.path.join(
self.tmp_dir, self.scratch_tmp_path, "DOC", "service_info.txt"
)
# params like --chdir, --partition and --time
srun_params = self.conf["srun_settings"].items()
self.srun_settings = [arg for param in srun_params for arg in param]
Expand All @@ -98,12 +95,13 @@ def __init__(
)

self.full_path = os.path.join(self.path, self.service_folder)
self.out_file = os.path.join(self.full_path, "DOC", "service_info.txt")

def srun_command(self, srun_settings, command):
command_list = [["srun"], srun_settings, command]
srun_command = [arg for command in command_list for arg in command]
subprocess.run(srun_command, check=True, shell=True)
return
exit_code = subprocess.call(srun_command)
return exit_code

def copy_scratch(self):
stderr.print("[blue]I will copy the service from %s" % self.full_path)
Expand All @@ -114,31 +112,35 @@ def copy_scratch(self):
if protocol == "rsync":
rsync_command = sysrsync.get_rsync_command(
source=self.full_path,
destination=self.conf["scratch_path"],
destination=self.conf["scratch_path"] + "/",
options=self.conf["options"],
exclusions=self.conf["exclusions"],
sync_source_contents=False,
)
self.srun_command(self.srun_settings, rsync_command)
exit_code = self.srun_command(self.srun_settings, rsync_command)

else:
stderr.print(
"[ref] This protocol is not allowed at the moment",
highlight=False,
)
sys.exit()
if exit_code == 0:
stderr.print(
"[green] Data copied to the sftp folder successfully",
highlight=False,
)
else:
f = open(self.out_file, "w")
f.write("Temporal directory: " + self.scratch_tmp_path + "\n")
f.write("Origin service directory: " + self.full_path + "\n")
f.close()
stderr.print(
"[ref] This protocol is not allowed at the moment",
"[green]Successfully copied the directory to %s"
% self.scratch_tmp_path,
highlight=False,
)
sys.exit()
f = open(self.out_file, "w")
f.write("Temporal directory: " + self.scratch_tmp_path + "\n")
f.write("Origin service directory: " + self.full_path + "\n")
f.close()
stderr.print(
"[green]Successfully copied the directory to %s"
% self.scratch_tmp_path,
highlight=False,
)
else:
stderr.print(f"[red]Errors while copying {self.full_path}")
except Exception as e:
stderr.print(e)
stderr.print(
Expand Down Expand Up @@ -173,7 +175,7 @@ def revert_copy_scratch(self):
if self.conf["protocol"] == "rsync":
# scratch_tmp cannot be used due to permission issues
scratch_bi_path = "".join(
self.conf["scratch_path"], self.service_folder
[self.conf["scratch_path"], self.service_folder]
)
rsync_command = sysrsync.get_rsync_command(
source=scratch_bi_path,
Expand Down
19 changes: 18 additions & 1 deletion bu_isciii/templates/services.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,22 @@
"last_folder":"RESULTS",
"delivery_md": "",
"results_md": ""
}
},
"IRMA": {
"label": "",
"template": "IRMA",
"url": "",
"order": 1,
"begin": "",
"end": "",
"description": "",
"clean": {
"folders":["02-preprocessing"],
"files":[]
},
"no_copy": ["RAW", "TMP"],
"last_folder":"REFERENCES",
"delivery_md": "",
"results_md": ""
}
}
Loading