Ejemplo n.º 1
0
    def log_env(self, rel_path: str = None, content: Dict = None):
        """Logs information about the environment.

        Called automatically if track_env is set to True.

        Can be called manually, and can accept a custom content as a form of a dictionary.

        Args:
            rel_path: str, optional, default "env.json".
            content: Dict, optional, default to current system information.
        """
        if not os.path.exists(self._outputs_path):
            return
        if not content:
            content = get_run_env()

        rel_path = rel_path or "env.json"
        path = self._outputs_path
        if rel_path:
            path = os.path.join(path, rel_path)

        with open(os.path.join(path), "w") as env_file:
            env_file.write(ujson.dumps(content))

        artifact_run = V1RunArtifact(
            name="env",
            kind=V1ArtifactKind.ENV,
            path=self.get_rel_asset_path(path=path),
            summary={"path": path},
            is_input=False,
        )
        self.log_artifact_lineage(body=artifact_run)
Ejemplo n.º 2
0
    def log_env(self):
        """Logs information about the environment.

        Called automatically if track_env is set to True.
        """
        env_data = get_run_env()
        with open(os.path.join(self._outputs_path, "env.json"),
                  "w") as env_file:
            env_file.write(ujson.dumps(env_data))
Ejemplo n.º 3
0
 def log_run_env(self):
     # TODO: log to file
     return get_run_env()
Ejemplo n.º 4
0
 def log_env(self):
     env_data = get_run_env()
     with open(os.path.join(self.outputs_path, ".polyaxon"), "w") as env_file:
         env_file.write(env_data)