Repository Commands#
The file repository is a feature of the Cluster Manager that allows you to store and share Gurobi files (models, solution parameters etc.). The main use is to store models so they can be reused later in different batch configurations.
In this section, we will review the most important file repository
commands. We assume that the system administrator has installed the
cluster and that you have successfully executed the grbcluster login
command with the appropriate flags to access your cluster.
Uploading a File to the Repository#
Any files supported by the Gurobi Optimizer can be uploaded and shared
in the repository. For example, let’s upload the glass4.mps
model
file with the following command:
grbcluster repo upload /Library/gurobi950/macos_universal2/examples/data/glass4.mps --container=training
info : Object 3f104672-52c8-4a53-ad79-4a01065ffefd created, upload done in container 'training'
A container is like a directory and is used to group files together so that you can retrieve them more easily later on. Once uploaded, you can check that the new file is available in the specified container with the following command:
grbcluster repo list --container=training
ID CONTAINER NAME CREATED SIZE USER USERID
3f104672 training glass4.mps 2019-09-22 21:51:10 86579 admin admin
Using a File from the Repository#
You can submit batches that use files from the repository as their
inputs. A file can be referenced using the full file object ID or the
file object path. A file object path starts with ’@’ and concatenates
the container and the object name with a ’/’ separator. For example, if
the object was uploaded in the container examples/app1
with name
model.mps
, you can reference it using:
@examples/app1/model.mps
One possible use of the file repository is to submit several batches that solve the same model using different parameters:
grbcluster batch solve @training/glass4.mps ResultFile=solution.sol Threads=2
info : Batch 7fe26af5-fbec-4e23-ad58-9ab4539f98f3 created
info : Batch 7fe26af5-fbec-4e23-ad58-9ab4539f98f3 submitted with job 4e359f99...
grbcluster batch solve @training/glass4.mps ResultFile=solution.sol Threads=5
info : Batch d2434fc9-b3df-4be0-bf2c-4d1eac2acb5e created
info : Batch d2434fc9-b3df-4be0-bf2c-4d1eac2acb5e submitted with job 8deeb020...
The model file was used in two batches, but only needed to be uploaded once.
Deleting a File from the Repository#
You can delete a file from the repository once you are done with it, but only if no batch is referencing it. If the file is still in use, you will be notified as in the following example:
grbcluster repo delete @training/glass4.mps
fatal : Object is in use by [7fe26af5-fbec-4e23-ad58-9ab4539f98f3]
The file may still be in use because a batch is running, or because the client did not yet download the results and discard the batch. Once there are no more references, the file will be deleted and you can check the container again:
> grbcluster repo delete @training/glass4.mps
> grbcluster repo list --container=training
ID CONTAINER NAME CREATED SIZE USER USERID