예제 #1
0
파일: list.py 프로젝트: jaytmiller/crds
 def list_config(self):
     """Print out configuration info about the current environment and server."""
     info = config.get_crds_env_vars()
     real_paths = config.get_crds_actual_paths(self.observatory)
     server = self.server_info
     current_server_url = api.get_crds_server()
     cache_subdir_mode = config.get_crds_ref_subdir_mode(self.observatory)
     pyinfo = _get_python_info()
     _print_dict("CRDS Environment", info)
     _print_dict("CRDS Client Config", { 
             "server_url" : current_server_url, 
             "cache_subdir_mode": cache_subdir_mode,
             "readonly_cache": self.readonly_cache,
             "effective_context": heavy_client.get_context_name(self.observatory),
             "crds" : repr(crds),
             "version": heavy_client.version_info() 
             })
     _print_dict("CRDS Actual Paths", real_paths)
     _print_dict("CRDS Server Info", server, 
                 ["observatory", "status", "connected", "operational_context", "last_synced", 
                  "reference_url", "mapping_url", "effective_mode"])
     if self.observatory == "hst":
         cal_vars = { var : os.environ[var] for var in os.environ
                       if len(var) == 4 and var.lower().endswith("ref") }
         _print_dict("Calibration Environment", cal_vars)
     _print_dict("Python Environment", pyinfo)
예제 #2
0
def refpath_to_parkeys(refpath):
    """Given a key for a TpnInfo's list, return the associated required parkeys."""
    from . import locate
    keys = []
    with log.verbose_warning_on_exception("Can't determine parkeys for",
                                          repr(refpath)):
        context = heavy_client.get_context_name("roman")
        p = crds.get_pickled_mapping(context)  # reviewed
        instrument, filekind = locate.get_file_properties(refpath)
        keys = p.get_imap(instrument).get_rmap(filekind).get_required_parkeys()
    return sorted(keys)
예제 #3
0
def refpath_to_parkeys(refpath):
    """Given a key for a TpnInfo's list, return the associated required parkeys."""
    from . import locate
    keys = []
    with log.verbose_warning_on_exception("Can't determine parkeys for", repr(refpath)):
        context  = heavy_client.get_context_name("jwst")
        p = crds.get_pickled_mapping(context)   # reviewed
        instrument, filekind = locate.get_file_properties(refpath)
        keys = p.get_imap(instrument).get_rmap(filekind).get_required_parkeys()
        # The below turned out to be bad because CRDS-only values aren't in datamodels
        # so in this case the datamodels schema are too narrow for these and will reject
        # e.g. SYSTEM or it's types.
        #         keys.append("META.INSTRUMENT.NAME")
        #         keys.append("META.REFTYPE")
    return sorted(keys)
예제 #4
0
파일: schema.py 프로젝트: jaytmiller/crds
def refpath_to_parkeys(refpath):
    """Given a key for a TpnInfo's list, return the associated required parkeys."""
    from . import locate
    keys = []
    with log.verbose_warning_on_exception("Can't determine parkeys for", repr(refpath)):
        context  = heavy_client.get_context_name("jwst")
        p = crds.get_pickled_mapping(context)   # reviewed
        instrument, filekind = locate.get_file_properties(refpath)
        keys = p.get_imap(instrument).get_rmap(filekind).get_required_parkeys()
        # The below turned out to be bad because CRDS-only values aren't in datamodels
        # so in this case the datamodels schema are too narrow for these and will reject
        # e.g. SYSTEM or it's types.
        #         keys.append("META.INSTRUMENT.NAME")
        #         keys.append("META.REFTYPE")
    return sorted(keys)
예제 #5
0
파일: list.py 프로젝트: jaytmiller/crds
 def list_status(self):
     """Print out *basic* configuration info about the current environment and server."""
     info = config.get_crds_env_vars()
     server = self.server_info
     pyinfo = _get_python_info()
     status = OrderedDict(
         [("CRDS_PATH", info.get("CRDS_PATH", "undefined")),
          ("CRDS_SERVER_URL", info.get("CRDS_SERVER_URL", "undefined")),
          ("CRDS_MODE", info["CRDS_MODE"]),
          ("Readonly Cache", self.readonly_cache),
          ("Cache Locking", crds_cache_locking.status()),
          ("Effective Context", heavy_client.get_context_name(self.observatory)),
          ("Last Synced", server.last_synced),
          ("CRDS Version", heavy_client.version_info()),
          ("Python Version", pyinfo["Python Version"]),
          ("Python Executable", pyinfo["Python Executable"]),
          ])
     _print_dict(None, status)
예제 #6
0
 def list_config(self):
     """Print out configuration info about the current environment and server."""
     info = config.get_crds_env_vars()
     real_paths = config.get_crds_actual_paths(self.observatory)
     server = self.server_info
     current_server_url = api.get_crds_server()
     cache_subdir_mode = config.get_crds_ref_subdir_mode(self.observatory)
     pyinfo = _get_python_info()
     _print_dict("CRDS Environment", info)
     _print_dict(
         "CRDS Client Config", {
             "server_url":
             current_server_url,
             "cache_subdir_mode":
             cache_subdir_mode,
             "readonly_cache":
             self.readonly_cache,
             "effective_context":
             heavy_client.get_context_name(self.observatory),
             "crds":
             repr(crds),
             "version":
             heavy_client.version_info()
         })
     _print_dict("CRDS Actual Paths", real_paths)
     _print_dict("CRDS Server Info", server, [
         "observatory", "status", "connected", "operational_context",
         "last_synced", "reference_url", "mapping_url", "effective_mode"
     ])
     download_uris = dict(
         config_uri=os.path.dirname(api.get_flex_uri("server_config")),
         pickle_uri=os.path.dirname(api.get_flex_uri("xyz.pmap.pkl")),
         mapping_uri=os.path.dirname(api.get_flex_uri("xyz.pmap")),
         reference_uri=os.path.dirname(api.get_flex_uri("xyz.fits")),
     )
     _print_dict("Actual Download URIs", download_uris)
     if self.observatory == "hst":
         cal_vars = {
             var: os.environ[var]
             for var in os.environ
             if len(var) == 4 and var.lower().endswith("ref")
         }
         _print_dict("Calibration Environment", cal_vars)
     _print_dict("Python Environment", pyinfo)
예제 #7
0
파일: list.py 프로젝트: jdavies-st/crds
 def list_status(self):
     """Print out *basic* configuration info about the current environment and server."""
     info = config.get_crds_env_vars()
     server = self.server_info
     pyinfo = _get_python_info()
     status = OrderedDict([
         ("CRDS_PATH", info.get("CRDS_PATH", "undefined")),
         ("CRDS_SERVER_URL", info.get("CRDS_SERVER_URL", "undefined")),
         ("CRDS_MODE", info["CRDS_MODE"]),
         ("Readonly Cache", self.readonly_cache),
         ("Cache Locking", crds_cache_locking.status()),
         ("Effective Context",
          heavy_client.get_context_name(self.observatory)),
         ("Last Synced", server.last_synced),
         ("CRDS Version", heavy_client.version_info()),
         ("Python Version", pyinfo["Python Version"]),
         ("Python Executable", pyinfo["Python Executable"]),
     ])
     _print_dict(None, status)