-
Notifications
You must be signed in to change notification settings - Fork 0
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
Draft:Add provenance functionality #1993
base: master
Are you sure you want to change the base?
Conversation
…ed of archiving (Now testing)
* add CI and dependabot gh actions * disable linting temporarily
* Autosubmit config version compatibility fix ( rebasing ) Reverting a conflict in the rebase to the other option II ( tests are only failing in the CI/CD ) Reverting a conflict in the rebase to the other option updated typing added a missing return Changed err_code function to return the err_code Rebase fix Squashed zombies/orphan and database fixes. PIPELINE Fix doc test Fix pipeline Added comments and typing (II ) Added comments and typing Test pipeline ( now with output) Test pipeline Update as version Fix tests, added pytest-xdist !475 vertical regression test [Single job] Test working, retrials working Changes to stat, db and retrials (WIP) Added database test, fixed some issues reduced time.sleeps Mock exists() so it works in the pipeline Fix events queue being reset in a platform failure clean import added more tests Changed the timeout removed debug message Added tests for signals cleanup code Added cleanup signal changes to signals and waitpid A new orphan/zombies code approach WIP: Looking good, some more fixes neccesaries and ready to be pushed WIP: Zombies/orphan processors logs fix * Pipeline failing, debug (I) * Fix Stat_0 file being deleted when it shouldn't * Fixed issues with the db and logs not being recovered in different run scenearios * Update VERSION * added process_jobs_to_submit fixes runtime issue * Added few todos that requires to change critical stuff * Fix runtime issue, recovery now shows a better output * Improved package test * Improved package test * Closing file descriptors on reconnect. * Fixes an issue with logs with this sequence of commands: `create + run + create + recovery + run` * Intregation test added, fixed few bugs * Fixed DB test * Now the db test also checks the stat and job_names in the filesystem * feedback * Changed test name, Added generic functions in the test to expand it with other run options * Added few todos * disabled the check exit code as it is not working on the pipeline and not important right now * Adding more chunks to the wrapper success * More detailed test * Add CI and dependabot GitHub actions (#2021) * add CI and dependabot gh actions * disable linting temporarily (cherry picked from commit 8a1b2df) * Improved test output in case of failure * more info * more info * Test adding +x * added chmod after sending * chmod added --------- Co-authored-by: dbeltran <daniel.beltran@bsc.es> Co-authored-by: Luiggi Tenorio <luiggibit@gmail.com> --------- Co-authored-by: dbeltran <daniel.beltran@bsc.es> Co-authored-by: Luiggi Tenorio <luiggibit@gmail.com> --------- Co-authored-by: dbeltran <daniel.beltran@bsc.es> Co-authored-by: Luiggi Tenorio <luiggibit@gmail.com>
* Added notify_on * added update_stat_file() (wrong rebase) --------- Co-authored-by: dbeltran <daniel.beltran@bsc.es>
* Fix issue with the wrapper attribute * Fix issue with the wrapper attribute
…a vertical wrapper (#2038)
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.
Sorry the delay in reviewing this, @apuiggro . Left some comments & suggestions. Can you rebase again, please.
.gitignore
Outdated
@@ -26,3 +26,6 @@ dockerfiles/id_rsa* | |||
dockerfiles/authorized_keys | |||
|
|||
venv/ | |||
|
|||
#metadata | |||
metadata/ |
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.
Is this ignore necessary to build the project? Or was it used for some local test? if it's not part of the AS build then it's better to not include it.
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.
Just saw you have a metadata/data/job_data_a000.sql
file in this change. I think you need to configure AS to write metadata in another directory. Can you remove that file if that's not needed for this PR?
autosubmit/provenance/rocrate.py
Outdated
@@ -555,8 +556,13 @@ def create_rocrate_archive( | |||
patch = json.loads(rocrate_json['PATCH']) | |||
for jsonld_node in patch['@graph']: | |||
crate.add_or_update_jsonld(jsonld_node) | |||
|
|||
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.
Unnecessary extra spaces ☝️
#zip is defined in this function so all the (modified) code should be moved here. Still, I'm exploring other posibilites | ||
#to query the las modified time within this function (Not very used to the code still...) | ||
date = time.strftime("%Y%m%d%H%M%S", time.localtime(os.path.getmtime(path))) | ||
crate.write_zip(Path(path, f"{expid}-{date}.zip")) |
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.
I think it'd be safer to go with the local time. The time the command was run.
Similar to how it's done in other commands like profiler, report, etc.:
datetime.datetime.today().strftime('%Y%m%d-%H%M%S')
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.
Okey! Should I leave it this way then?
date = datetime.datetime.today().strftime('%Y%m%d-%H%M%S')
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.
Yup!
autosubmit/autosubmit.py
Outdated
@@ -649,7 +655,7 @@ def parse_args(): | |||
subparser.add_argument('-v', '--update_version', action='store_true', | |||
default=False, help='Update experiment version') | |||
subparser.add_argument('--rocrate', action='store_true', default=False, | |||
help='Unarchive an RO-Crate file') | |||
help='Unarchive an RO-Crate file') |
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.
🙆♂️ thanks!
autosubmit/autosubmit.py
Outdated
@@ -2266,7 +2274,7 @@ def run_experiment(expid, notransitive=False, start_time=None, start_after=None, | |||
job_list.update_list(as_conf, submitter=submitter) | |||
job_list.save() | |||
# Submit jobs that are ready to run | |||
#Log.debug(f"FD submit: {fd_show.fd_table_status_str()}") | |||
#Log.debug(f"FD submit: {fd_show.fd_table_status_str()}")run_experiment |
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.
Was it a test? Maybe remove the run_experiment
(I think this might be used by dani for tesing -- although this can probably be refactored/removed in the future).
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.
Mmm... I believe I haven't added that (at least intentionally). I'll remove it :).
autosubmit/autosubmit.py
Outdated
:type expid: str | ||
:param rocrate: flag to enable RO-Crate | ||
:type rocrate: bool | ||
""""" |
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.
Too many quotes here. It's just three or one 🙂
autosubmit/autosubmit.py
Outdated
f"Error creating RO-Crate ZIP file: {str(e)}", 7012) | ||
else: | ||
raise AutosubmitCritical( | ||
"Can not create RO-Crate ZIP file. Argument '--rocrate' required", 7012) |
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.
I think we can invert the logic here, so that we don't create the Path
unnecessarily, and leave the validation/constraint logic first, followed by the main logic. Something like,
@staticmethod
def provenance(expid, rocrate=False):
"""
:param expid: experiment identifier
:type expid: str
:param rocrate: flag to enable RO-Crate
:type rocrate: bool
"""
if not rocrate:
msg = "Can not create RO-Crate ZIP file. Argument '--rocrate' required"
raise AutosubmitCritical(msg, 7012)
aslogs_folder = Path(
BasicConfig.LOCAL_ROOT_DIR,
expid,
BasicConfig.LOCAL_TMP_DIR,
BasicConfig.LOCAL_ASLOG_DIR
)
try:
Autosubmit.rocrate(expid, Path(aslogs_folder))
Log.info('RO-Crate ZIP file created!')
except Exception as e:
raise AutosubmitCritical(f"Error creating RO-Crate ZIP file: {str(e)}", 7012)
Autosubmit.provenance("expid123", rocrate=False) | ||
|
||
assert "Can not create RO-Crate ZIP file. Argument '--rocrate' required" in str(excinfo) | ||
mock_rocrate.assert_not_called() |
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.
test/unit/test_provenance.py
Outdated
from autosubmit.autosubmit import Autosubmit | ||
from log.log import AutosubmitCritical | ||
import os | ||
from unittest.mock import patch |
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.
test/unit/test_provenance.py
Outdated
@@ -0,0 +1,59 @@ | |||
import pytest |
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.
Tests look great! The rocrate
function is already covered, so good strategy to only cover the parts missing 👍
…ed of archiving (Now testing)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1993 +/- ##
=========================================
Coverage ? 48.92%
=========================================
Files ? 72
Lines ? 17564
Branches ? 3418
=========================================
Hits ? 8594
Misses ? 8161
Partials ? 809
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hi @kinow, Rebase finished! I believe all the issues are solved. Let me know if there is any other problem. Thankss |
In GitLab by @apuiggro on Oct 28, 2024, 12:18