使用Powershell更新Cosmos DB RU

时间:2019-09-06 13:00:28

标签: azure powershell azure-cosmosdb

我有一个包含许多收藏品的现有Cosmos数据库。 RU在收集级别上设置。

我想使用Powershell按需更新集合RU。我尝试使用以下命令,但遇到以下错误

size = (800, 800)
X = 0
Y = 0
R = 2
maxiter = 80000

ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)

output = np.empty(size[0]*size[1], dtype=np.uint8)

mf = cl.mem_flags
output_cl = cl.Buffer(ctx, mf.WRITE_ONLY, output.nbytes)

prg = cl.Program(ctx, """
    __kernel void mandelbrot(
        __global uchar *out,
        int width,
        int height,
        double real,
        double imag,
        double const radius,
        int const maxiter) {
            int id = get_global_id(0);

            int i = id % width;
            int j = id / width;

            double window_radius = (width < height) ? width : height;
            double x0 = real + radius * (2 * i - (float)width) / window_radius;
            double y0 = imag - radius * (2 * j - (float)height) / window_radius;
            double x = 0;
            double y = 0;

            int n = 0;
            double x_temp = 0;
            for(n = 0; n < maxiter; n++)
            {
                x_temp = x*x - y*y + x0;
                y = 2 * x*y + y0;
                x = x_temp;
                if (x*x + y*y > 4.0f){
                    break;
                }
            }
            if (n < maxiter) {
                out[id] = n*64;
            }
            else {
                out[id] = 0;
            }
    }
""").build()

prg.mandelbrot(queue, output.shape, None,
                output_cl,
                np.int32(size[0]),
                np.int32(size[1]),
                np.float64(X),
                np.float64(Y),
                np.float64(R),
                np.int32(maxiter),
                )

t0 = time.time()
cl.enqueue_copy(queue, output, output_cl).wait()
print(time.time() - t0, 'copy')

output = output.reshape((size[1], size[0]))

Invoke-WebRequest:远程服务器返回错误:(400)错误的请求。 在C:\ Program Files \ WindowsPowerShell \ Modules \ CosmosDB \ 2.1.7.675 \ lib \ utils.ps1:562 char:30 + ... estResult =调用WebRequest -UseBasicParsing @invokeWebRequestParam ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~     + CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpWebRequest)[Invoke-WebRequest],WebException     + FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

有什么建议吗?我遵循了以下链接,但存在相同的错误

https://github.com/PankajRawat333/CosmosDB#working-with-offers https://github.com/PlagueHO/CosmosDB/wiki/Set-CosmosDbOffer

1 个答案:

答案 0 :(得分:0)

我可以重现您的问题,它是由-OfferThroughput 555引起的,如评论中所述,offerThroughput必须是100的倍数,我用500这样的值进行测试,可以。

enter image description here

查看此链接-Offers

enter image description here