Add default auction params for deployment auction
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 46s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m16s
Smoke Test / Run basic test suite (pull_request) Successful in 4m39s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m43s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 7m48s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m49s
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 46s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m16s
Smoke Test / Run basic test suite (pull_request) Successful in 4m39s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m43s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 7m48s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m49s
This commit is contained in:
parent
e89fcb6687
commit
2bf1ed5653
@ -12,9 +12,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import shutil
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import yaml
|
import yaml
|
||||||
@ -43,23 +41,23 @@ def fatal(msg: str):
|
|||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--commits-duration",
|
"--commits-duration",
|
||||||
help="Auction commits duration (in seconds).",
|
help="Auction commits duration (in seconds) (default: 600).",
|
||||||
required=True,
|
default=600,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--reveals-duration",
|
"--reveals-duration",
|
||||||
help="Auction reveals duration (in seconds).",
|
help="Auction reveals duration (in seconds) (default: 600).",
|
||||||
required=True,
|
default=600,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--commit-fee",
|
"--commit-fee",
|
||||||
help="Auction bid commit fee (in alnt).",
|
help="Auction bid commit fee (in alnt) (default: 100000).",
|
||||||
required=True,
|
default=100000,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--reveal-fee",
|
"--reveal-fee",
|
||||||
help="Auction bid reveal fee (in alnt).",
|
help="Auction bid reveal fee (in alnt) (default: 100000).",
|
||||||
required=True,
|
default=100000,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--max-price",
|
"--max-price",
|
||||||
@ -88,44 +86,40 @@ def command(
|
|||||||
max_price,
|
max_price,
|
||||||
num_providers,
|
num_providers,
|
||||||
dry_run,
|
dry_run,
|
||||||
): # noqa: C901
|
):
|
||||||
tempdir = tempfile.mkdtemp()
|
laconic = LaconicRegistryClient(laconic_config)
|
||||||
try:
|
|
||||||
laconic = LaconicRegistryClient(laconic_config)
|
|
||||||
|
|
||||||
app_record = laconic.get_record(app)
|
app_record = laconic.get_record(app)
|
||||||
if not app_record:
|
if not app_record:
|
||||||
fatal(f"Unable to locate app: {app}")
|
fatal(f"Unable to locate app: {app}")
|
||||||
|
|
||||||
provider_auction_params = {
|
provider_auction_params = {
|
||||||
"kind": AUCTION_KIND_PROVIDER,
|
"kind": AUCTION_KIND_PROVIDER,
|
||||||
"commits_duration": commits_duration,
|
"commits_duration": commits_duration,
|
||||||
"reveals_duration": reveals_duration,
|
"reveals_duration": reveals_duration,
|
||||||
"denom": TOKEN_DENOM,
|
"denom": TOKEN_DENOM,
|
||||||
"commit_fee": commit_fee,
|
"commit_fee": commit_fee,
|
||||||
"reveal_fee": reveal_fee,
|
"reveal_fee": reveal_fee,
|
||||||
"max_price": max_price,
|
"max_price": max_price,
|
||||||
"num_providers": num_providers,
|
"num_providers": num_providers,
|
||||||
|
}
|
||||||
|
auction_id = laconic.create_auction(provider_auction_params)
|
||||||
|
print("Deployment auction created:", auction_id)
|
||||||
|
|
||||||
|
if not auction_id:
|
||||||
|
fatal("Unable to create a provider auction")
|
||||||
|
|
||||||
|
deployment_auction = {
|
||||||
|
"record": {
|
||||||
|
"type": "ApplicationDeploymentAuction",
|
||||||
|
"application": app,
|
||||||
|
"auction": auction_id,
|
||||||
}
|
}
|
||||||
auction_id = laconic.create_auction(provider_auction_params)
|
}
|
||||||
print("Deployment auction created:", auction_id)
|
|
||||||
|
|
||||||
if not auction_id:
|
if dry_run:
|
||||||
fatal("Unable to create a provider auction")
|
print(yaml.dump(deployment_auction))
|
||||||
|
return
|
||||||
|
|
||||||
deployment_auction = {
|
# Publish the deployment auction record
|
||||||
"record": {
|
laconic.publish(deployment_auction)
|
||||||
"type": "ApplicationDeploymentAuction",
|
|
||||||
"application": app,
|
|
||||||
"auction": auction_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if dry_run:
|
|
||||||
print(yaml.dump(deployment_auction))
|
|
||||||
return
|
|
||||||
|
|
||||||
# Publish the deployment auction record
|
|
||||||
laconic.publish(deployment_auction)
|
|
||||||
finally:
|
|
||||||
shutil.rmtree(tempdir, ignore_errors=True)
|
|
||||||
|
@ -465,7 +465,7 @@ class LaconicRegistryClient:
|
|||||||
return AttrDict(json.loads(logged_cmd(self.log_file, *args)))
|
return AttrDict(json.loads(logged_cmd(self.log_file, *args)))
|
||||||
|
|
||||||
def create_auction(self, auction):
|
def create_auction(self, auction):
|
||||||
if auction["kind"] == "provider":
|
if auction["kind"] == AUCTION_KIND_PROVIDER:
|
||||||
args = [
|
args = [
|
||||||
"laconic",
|
"laconic",
|
||||||
"-c",
|
"-c",
|
||||||
|
Loading…
Reference in New Issue
Block a user