Commit a1a8f2ef authored by Clément Haëck's avatar Clément Haëck
Browse files

Use absolute path in metadata and add hostname

parent 34fa6de6
......@@ -5,8 +5,9 @@ import configparser
import itertools
import os
import re
import sys
import socket
import subprocess
import sys
from datetime import datetime
from os import path
from typing import Any, Dict,List
......@@ -167,13 +168,15 @@ def setup_meta_attrs(ds: xr.Dataset,
"""Set some dataset attributes with information on how it was created.
Attributes are:
- "created_with": filename of the python script used (ie `argv[0]`).
- "created_with": hostname and filename of the python script used
- "created_with_args": a string representing the `args` dictionnary,
- "created_on": date of creation
- "created_on_commit": if found, the current/HEAD commit hash.
completed by `kwargs`.
"""
ds.attrs["created_with"] = sys.argv[0]
hostname = socket.gethostname()
script = path.normpath(path.abspath(sys.argv[0]))
ds.attrs["created_with"] = "{}:{}".format(hostname, script)
if args is None:
args = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment