Entries¶
NomadEntry
¶
Represents an entry in the NOMAD system.
This class encapsulates the data and metadata associated with an entry in the NOMAD database, including references, quantities, datasets, and processing information. It provides properties to access computed attributes such as URLs and job-related information derived from comments.
Attributes:
Name | Type | Description |
---|---|---|
entry_id |
str
|
Unique identifier for the entry. |
upload_id |
str
|
Identifier of the upload this entry belongs to. |
references |
list[str]
|
List of reference identifiers associated with this entry. |
origin |
str
|
The origin of the entry data. |
quantities |
list[str]
|
List of quantities measured or calculated for this entry. |
datasets |
list[NomadDataset]
|
List of datasets associated with this entry. |
n_quantities |
int
|
Number of quantities associated with this entry. |
nomad_version |
str
|
Version of the NOMAD software used. |
upload_create_time |
datetime
|
Creation time of the upload this entry is part of. |
nomad_commit |
str
|
Specific commit of the NOMAD software used. |
section_defs |
list[NomadSectionDefinition]
|
Definitions of sections used in this entry. |
processing_errors |
list[Any]
|
List of errors encountered during processing of this entry. |
last_processing_time |
datetime
|
Timestamp of the last processing attempt. |
parser_name |
str
|
Name of the parser used to process this entry. |
calc_id |
str
|
Calculation identifier associated with this entry. |
published |
bool
|
Flag indicating whether this entry is published. |
writers |
list[NomadUser]
|
List of users with write access to this entry. |
sections |
list[str]
|
List of section identifiers associated with this entry. |
processed |
bool
|
Flag indicating whether this entry has been processed. |
mainfile |
str
|
Name of the main file for this entry. |
main_author |
NomadUser
|
The main author of this entry. |
viewers |
list[NomadUser]
|
List of users with view access to this entry. |
entry_create_time |
datetime
|
Creation time of this entry. |
with_embargo |
bool
|
Flag indicating whether this entry is under embargo. |
files |
list[str]
|
List of file names associated with this entry. |
authors |
list[NomadUser]
|
List of authors associated with this entry. |
license |
str
|
License under which this entry is published. |
results |
Optional[dict]
|
Results associated with this entry, if any. |
entry_name |
Optional[str]
|
Name of this entry, if any. |
entry_type |
Optional[str]
|
Type of this entry, if any. |
domain |
Optional[str]
|
Domain of this entry, if any. |
optimade |
Optional[dict]
|
OPTIMADE data associated with this entry, if any. |
comment |
Optional[str]
|
Additional comments associated with this entry, if any. |
upload_name |
Optional[str]
|
Name of the upload this entry belongs to, if any. |
viewer_groups |
Optional[list[Any]]
|
Groups of users with view access, if any. |
writer_groups |
Optional[list[Any]]
|
Groups of users with write access, if any. |
text_search_contents |
Optional[list[str]]
|
Contents available for text search, if any. |
publish_time |
Optional[datetime]
|
Time when this entry was published, if any. |
entry_references |
Optional[list[dict]]
|
References associated with this entry, if any. |
use_prod |
Optional[bool]
|
Flag indicating whether this entry is from the production environment. |
Source code in martignac/nomad/entries.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
download_raw_data_of_job(job, timeout_in_sec=10)
¶
Downloads the raw data associated with a given job from the NOMAD system and stores it in the job's directory.
This function attempts to find NOMAD entries corresponding to the specified job, downloads the raw data for the first matching entry, and extracts it into the job's directory. It handles the creation of a temporary ZIP file for the raw data, extracts the relevant files, and cleans up the temporary files. Additionally, it updates the job's document with NOMAD dataset and upload IDs, and specific workflow information if available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job |
Job
|
The signac job object for which to download the raw data. |
required |
timeout_in_sec |
int
|
The maximum time in seconds to wait for a response from the server when downloading the raw data. Defaults to 10 seconds. |
10
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the raw data was successfully downloaded and processed, False if no corresponding NOMAD entries were found for the job. |
Raises:
Type | Description |
---|---|
TypeError
|
If the job's project does not derive from MartiniFlowProject. |
ValueError
|
If the found entries have inconsistent upload IDs, indicating a data retrieval or processing error. |
Source code in martignac/nomad/entries.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
|
find_entries_corresponding_to_job(job)
¶
Finds NOMAD entries that correspond to a given job.
This function searches for NOMAD entries that are associated with the specified job. It checks if the job's project is a subclass of MartiniFlowProject. If not, it raises a TypeError. The function then proceeds to match entries based on the job's ID and the hash of MDP files associated with the job. It combines entries found through querying the NOMAD dataset with entries associated with uploads owned by the current user. If entries with inconsistent upload IDs are found, a ValueError is raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job |
Job
|
The signac job object to find corresponding NOMAD entries for. |
required |
Returns:
Type | Description |
---|---|
list[NomadEntry]
|
list[NomadEntry]: A list of NomadEntry objects that correspond to the given job. |
Raises:
Type | Description |
---|---|
TypeError
|
If the job's project does not derive from MartiniFlowProject. |
ValueError
|
If found entries have inconsistent upload IDs, indicating a data retrieval or processing error. |
Source code in martignac/nomad/entries.py
get_entries_in_database(database_id=DEFAULT_DATABASE, use_prod=DEFAULT_USE_PROD)
¶
Retrieves a list of NomadEntry objects from a specified database.
This function queries the NOMAD system for entries within a specified database, using the provided database ID.
It allows specifying whether to use the production or test environment for the query. The function leverages
the query_entries
function to perform the actual query based on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
database_id |
str
|
The unique identifier of the database from which to retrieve entries.
Defaults to the value of |
DEFAULT_DATABASE
|
use_prod |
bool
|
Flag indicating whether to use the production environment. Defaults to the value
of |
DEFAULT_USE_PROD
|
Returns:
Type | Description |
---|---|
list[NomadEntry]
|
list[NomadEntry]: A list of NomadEntry objects corresponding to the entries found in the specified database. |
Source code in martignac/nomad/entries.py
get_entries_of_my_uploads(use_prod=False, timeout_in_sec=10)
¶
Retrieves a list of NomadEntry objects associated with the uploads owned by the current user.
This function iterates over all uploads owned by the current user, identified through their unique upload IDs, and aggregates all entries associated with these uploads. It allows specifying whether to use the production or test environment for the NOMAD system, and a timeout for the request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_prod |
bool
|
Flag indicating whether to use the production environment. Defaults to False, indicating that the test environment is used by default. |
False
|
timeout_in_sec |
int
|
The maximum time in seconds to wait for a response from the server. Defaults to 10 seconds. |
10
|
Returns:
Type | Description |
---|---|
list[NomadEntry]
|
list[NomadEntry]: A list of NomadEntry objects corresponding to the entries associated with the uploads owned by the current user. |
Source code in martignac/nomad/entries.py
get_entries_of_upload(upload_id, use_prod=False, with_authentication=False, timeout_in_sec=10)
¶
Retrieves a list of NomadEntry objects associated with a specific upload ID.
This function sends a GET request to the NOMAD system to retrieve all entries associated with a given upload ID. It allows specifying whether to use the production or test environment, whether authentication is required for the request, and a timeout for the request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
upload_id |
str
|
The unique identifier of the upload whose entries are to be retrieved. |
required |
use_prod |
bool
|
Flag indicating whether to use the production environment. Defaults to False. |
False
|
with_authentication |
bool
|
Flag indicating whether the request should include authentication. Defaults to False. |
False
|
timeout_in_sec |
int
|
The maximum time in seconds to wait for a response from the server. Defaults to 10 seconds. |
10
|
Returns:
Type | Description |
---|---|
list[NomadEntry]
|
list[NomadEntry]: A list of NomadEntry objects corresponding to the entries of the specified upload ID. |
Raises:
Type | Description |
---|---|
HTTPError
|
If the request fails or the NOMAD system returns an error response. |
Source code in martignac/nomad/entries.py
get_entry_by_id(entry_id, use_prod=True, with_authentication=False, timeout_in_sec=10)
¶
Retrieves a NomadEntry object by its unique entry ID.
This function sends a GET request to the NOMAD system to retrieve the details of a specific entry identified by its unique ID. It allows specifying whether to use the production or test environment, whether authentication is required for the request, and a timeout for the request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry_id |
str
|
The unique identifier of the entry to retrieve. |
required |
use_prod |
bool
|
Flag indicating whether to use the production environment. Defaults to True. |
True
|
with_authentication |
bool
|
Flag indicating whether the request should include authentication. Defaults to False. |
False
|
timeout_in_sec |
int
|
The maximum time in seconds to wait for a response from the server. Defaults to 10 seconds. |
10
|
Returns:
Name | Type | Description |
---|---|---|
NomadEntry |
NomadEntry
|
The NomadEntry object corresponding to the provided entry ID. |
Raises:
Type | Description |
---|---|
HTTPError
|
If the request fails or the NOMAD system returns an error response. |
Source code in martignac/nomad/entries.py
query_entries(workflow_name=None, program_name=None, dataset_id=None, origin=None, page_size=10, max_entries=50, use_prod=True)
¶
Queries the NOMAD system for entries based on various filters and returns a list of NomadEntry objects.
This function constructs a query to the NOMAD system, allowing for filtering based on workflow name, program name,
dataset ID, and origin. It supports pagination through page_size
and limits the number of entries returned with
max_entries
. The environment (production or test) can be specified with use_prod
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow_name |
str
|
Filter entries by the name of the workflow. Defaults to None. |
None
|
program_name |
str
|
Filter entries by the program name. Defaults to None. |
None
|
dataset_id |
str
|
Filter entries by the dataset ID. Defaults to None. |
None
|
origin |
str
|
Filter entries by their origin. Defaults to None. |
None
|
page_size |
int
|
Number of entries to return per page. Defaults to 10. |
10
|
max_entries |
int
|
Maximum number of entries to return. Defaults to 50. |
50
|
use_prod |
bool
|
Flag indicating whether to query the production environment. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
list[NomadEntry]
|
list[NomadEntry]: A list of NomadEntry objects that match the query criteria. |