Skip to main content

BohriumToolkit

A class representing a toolkit for interacting with Bohrium services. Parameters:
  • timeout (Optional[float], optional): The timeout for BohriumToolkit. (default: :obj:None)
  • api_key (Optional[str], optional): The API key for Bohrium client. (default: :obj:None)
  • project_id (Optional[int], optional): The project ID for Bohrium client. (default: :obj:None)
  • yaml_path (Optional[str], optional): The path to the YAML file containing the job parameters. (default: :obj:None)

init

_custom_insert

refactor insert method, ensure return jobId information

submit_job

Submit a job to Bohrium. Parameters:
  • job_name (str): The name of the job. It will be updated when yaml file is provided. The yaml file might be set when initialize BohriumToolkit. (default: :obj:bohr-job)
  • machine_type (str): The type of machine to use. It will be updated when yaml file is provided. The yaml file might be set when initialize BohriumToolkit. (default: :obj:c2_m4_cpu)
  • cmd (str): The command to run. It will be updated when yaml file is provided. The yaml file might be set when initialize (default: :obj:mpirun -n 2 lmp_mpi -i in.shear)
  • image_address (str): The address of the image to use. It will be updated when yaml file is provided. The yaml file might be set when initialize BohriumToolkit. (default: :obj:registry.dp.tech/dptech/lammps:29Sep2021)
Returns: Dict[str, Any]: The result of the job submission.

get_job_details

Get details for a specific job. Parameters:
  • job_id (int): The ID of the job.
Returns: Dict[str, Any]: The job details.

terminate_job

Terminate a running job. Parameters:
  • job_id (int): The ID of the job to terminate.
Returns: Dict[str, Any]: The result of the termination request.

kill_job

Kill a running job. Parameters:
  • job_id (int): The ID of the job to kill.
Returns: Dict[str, Any]: The result of the kill request.

get_job_logs

Get logs for a specific job. Parameters:
  • job_id (int): The ID of the job.
  • log_file (str, optional): The log file to get. (default: :obj:STDOUTERR)
  • page (int, optional): The page number. (default: :obj:-1)
  • page_size (int, optional): The page size. (default: :obj:8192)
Returns: str: The log contents.

create_job_group

Create a job group. Parameters:
  • project_id (int): The ID of the project.
  • job_group_name (str): The name of the job group.
Returns: Dict[str, Any]: The result of the job group creation.

download_job_results

Download the results of a job. Parameters:
  • job_id (int): The ID of the job.
  • save_path (str): The path to save the results to.
Returns: Dict[str, Any]: The result of the download request.

get_tools

Returns: List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.