uv_poll_close should invalidate the FD immediately

uv_stream_close calls uv__io_close, which, in turn, calls uv__platform_invalidate_fd which removes the FD from epoll.  So as soon as we close the stream, the underlying FD is removed from epoll.
uv_poll_close doesn't call uv__io_close, which causes issues like https://github.com/MagicStack/uvloop/issues/61.   In the linked issue, the FD (let's call it FD{poll}) that was used with a poll handle, is a duplicate of another FD (let's call it FD{stream}) wrapped in a stream.  If we close FD{poll} and keep the FD{stream} alive, epoll will spit out EBADF for FD{poll}, because it will try to be removed after it's already closed by the caller of uv_poll_close.
So I propose to modify uv_poll_close to call uv__io_close internally, like stream handlers already do.

Do you mean uv_poll_stop() rather than uv_poll_close()?  I don't think that's an acceptable change.  The contract with the user is that libuv borrows the file descriptor until uv_poll_stop() is called, after which ownership returns to the user.
From the documentation:

The user should not close a file descriptor while it is being polled by an active poll handle. This can cause the handle to report an error, but it might also start polling another socket. However the fd can be safely closed immediately after a call to :c:func:uv_poll_stop or :c:func:uv_close.

I am not sure that uv_poll should close FD. E.g. I use libuv to poll ZeroMQ sockets. To do this ZeroMQ provide some internal descriptor. This is from doc

The returned file descriptor is intended for use with a poll or similar system call only. Applications must never attempt to read or write data to it directly, neither should they try to close it.

Agreed with @bnoordhuis on not actually closing the fd.  uv__io_close doesn't close the fd though: https://github.com/libuv/libuv/blob/v1.x/src/unix/core.c#L890-L896  So I think @1st1 is right and we should forget about the fd while not closing it.

The contract with the user is that libuv borrows the file descriptor until uv_poll_stop() is called, after which ownership returns to the user.

I am not sure that uv_poll should close FD. E.g. I use libuv to poll ZeroMQ sockets. To do this ZeroMQ provide some internal descriptor. This is from doc

I'm not talking about closing the FD. I'm talking about immediately stopping epolling it in uv_poll_stop and uv_poll_close. The current code in libuv causes bugs/CPU burn if the duped socket is closed after calling uv_poll_close - this needs to be fixed.

So I think @1st1 is right and we should forget about the fd while not closing it.

Thanks! I'll make a PR.

Is this fixed?

I'll update my PR

Sure.. Please let me know the libuv version once it is fixed.


Read config file to support multiple charts simultaneously

To make this operator more versatile, it could be updated to support watching multiple CRs, each mapped to a different Helm chart directory based on the contents of a config file, much like github.com/water-hole/ansible-operator
Something like this:
---

- group: example.com
  version: v1alpha1
  kind: MyApp
  chart: /charts/myapp

- group: example.com
  version: v1alpha1
  kind: MyDatabase
  chart: /charts/mydatabase

I'd propose adding a new environment variable (e.g. HELM_WATCHES_FILE). If it is present and set, read the mapping config from it. If not, just fall back to the existing environment variables to maintain backward compatibility.
It looks pretty straightforward to update register.go to expose a function to dynamically add new types to the scheme, and to update helm.go to use a GVK -> chartDir lookup rather than a static chartDir setting.
Thoughts?

Closed by #48


Wrong column name in predicates with connected fields

Describe the bug
The following statement should translate Post.keys.user to postUserId
Amplify.DataStore.query(Post.self, where: Post.keys.user == Service.shared.userId()

However the following error occurs:
no such column: root.user in "select
  "root"."id" as "id", "root"."createdTimestamp" as "createdTimestamp", "root"."imageUrl" as "imageUrl",
  "root"."text" as "text", "root"."updatedTimestamp" as "updatedTimestamp", "root"."postUserId" as "postUserId",
  "user"."id" as "user.id", "user"."bio" as "user.bio", "user"."createdTimestamp" as "user.createdTimestamp",
  "user"."emailAddress" as "user.emailAddress", "user"."fullName" as "user.fullName", "user"."isEditable" as "user.isEditable",
  "user"."isFollowing" as "user.isFollowing", "user"."profileImageUrl" as "user.profileImageUrl", "user"."updatedTimestamp" as "user.updatedTimestamp"
from Post as root
inner join User as user
  on "user"."id" = "root"."postUserId"
where 1 = 1
  and "root"."user" = ?"
Failed to retrieve posts: DataStoreError: The operation couldn’t be completed. (SQLite.Result error 0.)

Referring to a model
type User @model {
  id: ID!
  fullName: String!
  emailAddress: String
  bio: String
  profileImageUrl: String
  isFollowing: Boolean
  following: [UserFollowing] @connection(name: "UserFollowing")
  followers: [UserFollowers] @connection(name: "UserFollowers")
  isEditable: Boolean
  posts: [Post] @connection(name: "UserPosts")
  createdTimestamp: Int!
  updatedTimestamp: Int
}

type Post @model {
  id: ID!
  user: User! @connection(name: "UserPosts")
  text: String
  imageUrl: String
  createdTimestamp: Int!
  updatedTimestamp: Int
}

Amplify will generate the following:
Post.swift
// swiftlint:disable all
import Amplify
import Foundation

public struct Post: Model {
  public let id: String
  public var user: User
  public var text: String?
  public var imageUrl: String?
  public var createdTimestamp: Int
  public var updatedTimestamp: Int?

  public init(id: String = UUID().uuidString,
      user: User,
      text: String? = nil,
      imageUrl: String? = nil,
      createdTimestamp: Int,
      updatedTimestamp: Int? = nil) {
      self.id = id
      self.user = user
      self.text = text
      self.imageUrl = imageUrl
      self.createdTimestamp = createdTimestamp
      self.updatedTimestamp = updatedTimestamp
  }
}

Post+schema.swift
// swiftlint:disable all
import Amplify
import Foundation

extension Post {
  // MARK: - CodingKeys
   public enum CodingKeys: String, ModelKey {
    case id
    case user
    case text
    case imageUrl
    case createdTimestamp
    case updatedTimestamp
  }

  public static let keys = CodingKeys.self
  //  MARK: - ModelSchema

  public static let schema = defineSchema { model in
    let post = Post.keys

    model.pluralName = "Posts"

    model.fields(
      .id(),
      .belongsTo(post.user, is: .required, ofType: User.self, targetName: "postUserId"),
      .field(post.text, is: .optional, ofType: .string),
      .field(post.imageUrl, is: .optional, ofType: .string),
      .field(post.createdTimestamp, is: .required, ofType: .int),
      .field(post.updatedTimestamp, is: .optional, ofType: .int)
    )
    }
}

as you can see post.user should have a target of postUserId however when using post.keys.user, the column cannot be found.
Solution:
To solve this issue, the following statement works:
Amplify.DataStore.query(Post.self, where: field("postUserId") == Service.shared.userId()
This does work, but without looking at the Post+schema, a user should not reasonably expect understand this, they should be able to look at the model to understand the connections, as the schema is really implementation details?

This is still a relevant issue and needs to be triaged and prioritized.

facing same issue with my data model. My current workaround is to query first the user than the posts in 2 separate calls and assign the posts to the user object.

We reverted #885 because of some unexpected log chatter that exposed a possible problem with the approach. We're investigating a different approach and will update when we have more info.

https://github.com/aws-amplify/amplify-ios/pull/965 is merged and released, closing this issue, feel free to reopen if the issue persists

https://github.com/aws-amplify/amplify-ios/pull/965 is merged and released, closing this issue, feel free to reopen if the issue persists


[TF 2.0 Nightly] Tensorflow 2.0 nightly build doesn't work with colab TPUs

TPU strategy can't be instantiated in colab. I am aware that this issue might be more suitable for colaboratory  github but there many issues are not getting a response very fast so I thought it will be better to ask you about a potential solution (if there is a bug related to the last build and not google colab environment) or whether it is planned that colab will have this support in the nearby future.
The following link demonstrates the issue: https://colab.research.google.com/drive/1DsM_lsZXvBnlz3weymB8GHQ6cjoaxPgq
TPU runtime was selected and the version of the installed tf2.0 is '2.1.0-dev20191024'. Thanks!

Can you try with  2.1.0-dev20191020 instead? There is a failure in between 20 and 22 that I'm currently investigating, so just in case that's also the issue you're seeing, please try with 20.

@mihaimaruseac I tried it but it results in the same error.

Looking back, it doesn't seem related to what I was debugging

I have tried on colab with TF version 2.1.0-dev20191024 ,2.1.0-dev20191020, 2.1.0-dev20191021,2.1.0-dev20191022 ,2.1.0-dev20191019 and was able to reproduce the issue.Please, find the gist here. Thanks!

Yes, this expected due to how TPUs and Colab work: You can upgrade the version of TensorFlow in Colab kernel but the version of TensorFlow on the remote TPU currently cannot be changed. We have ongoing work to fix this, which will hopefully land in the next few weeks. In the meantime, if you want to use TF2.0 and TPU and have access to Cloud TPU, you can allocate a one with the version 'nightly-2.x' and then follow the instructions here to setup and connect to a Colab runtime running on the Cloud TPU VM.

@bfontain Thank you! I will use your solution in the meantime. Is there any way I can follow the progress with colab's TPUs?

No problem. I'll update this bug once above mentioned work is finished.

@bfontain I've been trying your solution past couple of days but I couldn't figure out why I can't make it work.
I created a VM instance in google cloud and after that a TPU instance. Both are on the same zone and have the same name. For the TPU computing instance I've specified the tensorflow version by setting the --tf-version flag to "nightly-2.x". They were both created and I connected to the VM as described in guides. So far, so good. The problem appears when I'm trying to run the following python script to check connection to TPU.
import tensorflow as tf
print(tf.__version__)

tpu_addr = 'grpc://{ip}:8470'
cluster_resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu_addr)
tf.config.experimental_connect_to_cluster(cluster_resolver)
tf.tpu.experimental.initialize_tpu_system(cluster_resolver)
strategy = tf.distribute.experimental.TPUStrategy(cluster_resolver)

print(strategy)

The problem is that the process hangs with the following output:
georgealexandruvlad@tpu-bert:~$ python3 file.py
2019-11-06 22:19:16.116169: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2019-11-06 22:19:16.116213: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2.1.0-dev20191106
2019-11-06 22:19:17.457940: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2019-11-06 22:19:17.457982: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2019-11-06 22:19:17.458016: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (tpu-bert): /proc/driver/nvidia/version does not exist
2019-11-06 22:19:17.458833: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2019-11-06 22:19:17.466620: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency:<PHONE_NUMBER> Hz
2019-11-06 22:19:17.466836: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x556822a2a050 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2019-11-06 22:19:17.466937: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2019-11-06 22:19:17.473816: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job worker -> {0 -> <IP_ADDRESS>:8470}
2019-11-06 22:19:17.473853: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job localhost -> {0 -> localhost:32891}georgealexandruvlad@tpu-bert:~$ python3 file.py
2019-11-06 22:19:16.116169: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2019-11-06 22:19:16.116213: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2.1.0-dev20191106
2019-11-06 22:19:17.457940: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2019-11-06 22:19:17.457982: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2019-11-06 22:19:17.458016: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (tpu-bert): /proc/driver/nvidia/version does not exist
2019-11-06 22:19:17.458833: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2019-11-06 22:19:17.466620: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency:<PHONE_NUMBER> Hz
2019-11-06 22:19:17.466836: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x556822a2a050 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2019-11-06 22:19:17.466937: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2019-11-06 22:19:17.473816: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job worker -> {0 -> <IP_ADDRESS>:8470}
2019-11-06 22:19:17.473853: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job localhost -> {0 -> localhost:32891}

I installed on the vm the last tf-nightly version and checked that it is seen by the system. Both instances have owner permissions to rule out the possibility of a any restrictions of this kind.
Do you happen to know what might be the cause of this error? I've searched a lot past few days and I have no idea how to solve it. I'm trying to find out if there is a bug and I should stop searching or it's something faulty in my approach.

If you have the chance, can you try setting tpu_addr to just the name of the cloud tpu you allocated rather than the grpc://+ip address? TPUClusterResolver should be able to figure everything out from just that information, so long as the GCE instance is in the same zone/project as the TPU.

Already tried this. I've checked again to be sure and it has the following output:
2019-11-07 09:35:32.471945: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2019-11-07 09:35:32.471988: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2.1.0-dev20191106
2019-11-07 09:35:34.243429: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2019-11-07 09:35:34.243479: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2019-11-07 09:35:34.243516: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (tpu-bert): /proc/driver/nvidia/version does not exist
2019-11-07 09:35:34.460615: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2019-11-07 09:35:34.709331: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency:<PHONE_NUMBER> Hz
2019-11-07 09:35:34.709561: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55abc59a2790 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2019-11-07 09:35:34.709587: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2019-11-07 09:35:34.861465: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job worker -> {0 -> <IP_ADDRESS>:8470}
2019-11-07 09:35:34.861517: I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:300] Initialize GrpcChannelCache for job localhost -> {0 -> localhost:31015}

As you said, based on the name it figures out the IP address and port to the TPU but unfortunately it hangs again.

OK, I just tried this with a new gce instance with 2.1.0-dev20191106 installed and a freshly created v3-8 TPU (running in europe-west4-a) with nightly-2.x and your code worked for me. In my case I created the GCE instance and TPU by hand in the cloud console and the only non-default settings I had to use for the GCE instance other than the name//region was to 'Allow full access to all Cloud APIs'. For the TPU, I picked the nightly-2.x version and a v3-8.
What your seeing is the same symptom I see if I pick an address/port that the GCE instance can't connect to. Was your TPU created in the same project as the GCE instance?
There is a slight possibility that you ended up with a bad combination TensorFlow versions and TPU/nightly-2.x version. Could you try deleting and recreating the TPU?

Yes, they were created in the same project otherwise the VM wouldn't have set the environment variable TPU_NAME, as I understood. After connecting to the VM I've checked for this. I deleted and created more than 10 VMs and TPUs past few days but I will give it a try again. It's important that you succeeded and now I know the problem is on my side. Thanks for that!

Thanks for being patient with this. I talked with one of my colleagues who is more familiar with Cloud TPU issues. Is there anyway that the TPU and GCE instance are on different networks? In my GCE instance has network 'default' under 'Network interfaces' and the TPU has network 'default' under its 'Network endpoints'.
If the network matches, is there any chance that you have custom firewall rules?

My colleague took a closer look at your issue and suggested that you file a bug here https://issuetracker.google.com/issues/new?component=508028 so they can help you directly.

I checked the firewall rules and everything is on default. I've tried to make the instances directly from the console as you did and I left everything on default less the zone, the tf version for TPU (going for nightly-2.x) and the name which I made sure it's the same for both. I also checked the 'Allow full access to all Cloud APIs'. box. So I get a Debian VM and a TPU (I tried with v2-8 and v3-8). On the VM I installed python-3.7 for tensorflow 2.0 to work and tried to run the code I posted in here. Unfortunately, it resulted in the same problem. I will file an issue to the link you provided. Thanks a lot for your time!

Hi, @bfontain ! Do you have any new information about the progress on the issue?

Hi, right now you can try '%tensorflow_version 2.x' in a cell. That will bring you to TF 2.0 + a 2.0 TPU backend. Once 2.1 is released then I believe that will switch to 2.1. I'm currently working with the colab team to see if we can implement a '%tensorflow_version nightly' (this does not work right now).

Sorry for the delay, it looks like %tensorflow_version 2.x now brings in TF2.1-rc1 and works on TPUs. As an example of directly using TPUs in colab + TF 2.x, a colleague recently posted this colab notebook: https://colab.research.google.com/github/znah/tpu4fun/blob/master/feature_viz.ipynb


Sorting?

Hey, can i use sorting with exceljs, cant find a function for that
I would like to sort a column ascending or descending

Same request here!!

No comments on this? This is what I am looking for as well.

I also would came here to find this feature.

Need the same as well.

I just implemented my own sort function and figured I'd put it up here in case anyone finds it useful. Not very pretty but it works.
const sortByColumn = columnNum => {
  if (worksheet) {
    columnNum--;
    const sortFunction = (a, b) => {
      if (a[columnNum] === b[columnNum]) {
        return 0;
      }
      else {
        return (a[columnNum] < b[columnNum]) ? -1 : 1;
      }
    }
    let rows = [];
    for (let i = 1; i <= worksheet.actualRowCount; i++) {
      let row = [];
      for (let j = 1; j <= worksheet.columnCount; j++) {
        row.push(worksheet.getRow(i).getCell(j).value);
      }
      rows.push(row);
    }
    rows.sort(sortFunction);
    // Remove all rows from worksheet then add all back in sorted order
    worksheet.spliceRows(1, worksheet.actualRowCount);
    // Note worksheet.addRows() may add them to the end of empty rows so loop through and add to beginnning
    for (let i = rows.length; i >= 0; i--) {
      worksheet.spliceRows(1, 0, rows[i]);
    }
    let x = 1;
  }
}

Thank you @FriendOfTheNight
Typescript version with ability to choose sort order (h2l: high to low) starting and ending row
Also last lines can be done in 1 line as worksheet.spliceRows accept insert
function sortColumn(worksheet: Worksheet, column: number, h2l: boolean = true, startRow: number = 1, endRow?: number): void {
    endRow = endRow || worksheet.actualRowCount;
    column--;

    const sortFunction = (a: CellValue[], b: CellValue[]): number => {
        if (a[column] === b[column]) {
            return 0;
        }
        else {
            if(h2l) {
                return (a[column] > b[column] && h2l) ? -1 : 1;
            }
            else {
                return (a[column] < b[column]) ? -1 : 1;
            }
        }
    }

    let rows: CellValue[][] = [];
    for (let i = startRow; i <= endRow; i++) {
        let row: CellValue[] = [];
        for (let j = 1; j <= worksheet.columnCount; j++) {
            row.push(worksheet.getRow(i).getCell(j).value);
        }
        rows.push(row);
    }
    rows.sort(sortFunction);

    // Remove all rows from worksheet then add all back in sorted order
    worksheet.spliceRows(startRow, endRow, ...rows);
}


fix(plugins/plugin-kubectl): kubectl create --dry-run | kubectl apply…

… -f - does not work
Fixes #7443

Description of what you did:

My PR is a:

[ ] 💥 Breaking change
[x] 🐛 Bug fix
[ ] 💅 Enhancement
[ ] 🚀 New feature

Please confirm that your PR fulfills these requirements

[x] Multiple commits are squashed into one commit.
[x] The commit message follows Conventional Commits, which allows us to autogenerate release notes; e.g. fix(plugins/plugin-k8s): fixed annoying bugs
[x] All npm dependencies are pinned.

/lgtm


Fix slo-monitor dependencies

What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #1481
Special notes for your reviewer:
/cc @mborsz
Does this PR introduce a user-facing change?:
NONE

Rubber stump approval to not block this. Please get it reviewed by @mborsz
/approve
/hold

/lgtm
Let's merge this given that it fixes the broken tests. The broken tests block other PRs.

/unhold


workflowRestrictions Should Not Effect Cron Workflow Adhoc Runs

Pre-requisites

[X] I have double-checked my configuration
[X] I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
[X] I have searched existing issues and could not find a match for this bug
[X] I'd like to contribute the fix myself (see contributing guide)

What happened? What did you expect to happen?
For the record I lied on the above prerequisites because they didn't apply. I also did not test on latest because this setting is only true on our more locked down higher environments where I cannot arbitrarily change the service version.
When attempting to submit a cron workflow adhoc, I am unable to do so when workflowRestriction is set.
I don't know if this is a bug report or a feature request, but to me it seems like a bug. IMO the "purpose" of requiring template referencing is to ensure all workflow runs are gated by version control (given that you only allow workflow templates to be created via git/CICD).
running a cron adhoc should serve the same purpose of requiring a workflow to be defined via a resource in the cluster prior to the run.

Version(s)
v3.5.8
Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflow that uses private images.
Any cron workflow should do.

Logs from the workflow controller
N/A

Logs from in your workflow's wait container
N/A

This is by design.
This helps to prevent users from submitting arbitrary workflows.
Cronworkflow also needs to use templateRef in their spec such that below workflow is not allowed
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: hello-world
spec:
  schedule: "* * * * *"
  timezone: "America/Los_Angeles"   # Default to local machine timezone
  startingDeadlineSeconds: 0
  concurrencyPolicy: "Replace"      # Default to "Allow"
  successfulJobsHistoryLimit: 4     # Default 3
  failedJobsHistoryLimit: 4         # Default 1
  suspend: false                    # Set to "true" to suspend scheduling
  workflowSpec:
    entrypoint: hello-world-with-time
    templates:
      - name: hello-world-with-time
        container:
          image: busybox
          command: [echo]
          args: ["🕓 hello world. Scheduled on: {{workflow.scheduledTime}}"]

Hi @tczhao, I do understand the intent that "This helps to prevent users from submitting arbitrary workflows."
My argument, as stated in the original ticket is that "running a cron adhoc should serve the same purpose of requiring a workflow to be defined via a resource in the cluster prior to the run.".
A cron workflow has to exist before it can be submitted, exactly like a workflow template.
You cannot submit an arbitrary workflow if you're doing so by submitting a cronjob. And, these workflows are themselves submitted by the controller without a template reference, so I don't think your argument has much merit.
I think this was an oversight/unintended consequence of the design, and should require another look.

Am I missing some detail that would make it possible for a person to submit arbitrary workflow using a cron?


Add workflow to handle stale discussions

Description of changes: See https://github.com/aws-github-ops/handle-stale-discussions
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Codecov Report
Patch coverage has no change and project coverage change: -0.03 :warning:

Comparison is base (2f1f009) 93.36% compared to head (f80d38e) 93.33%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2981      +/-   ##
===========================================
- Coverage    93.36%   93.33%   -0.03%
===========================================
  Files           65       65
  Lines        13841    13841
===========================================
- Hits         12923    12919       -4
- Misses         918      922       +4

see 3 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.


BUG - Unable to fill the standup after updating the standup config

Summary
Unable to fill the standup after updating the standup config.
Steps To Reproduce
Steps to reproduce the behavior:

Fill your standup for the day.
Update all the standup config sections.
Try to fill/update your standup again.
Notice that you cannot fill the standup.

Expected behavior
The user would be able to fill there standup again.
Observed Behavior
Users are unable to fill the standup.
Screenshots

Environment

Mattermost version: 5.12.0
OS: Ubuntu 18.08
Platform: browser, desktop app
Browser: electron app/chrome

+1

@eyebank are you on the latest version of the plugin and still facing the error?


the learning rate adjustment when training with one gpu or two gpus

Thanks for your code.
When I training this code with two GPUs (Tesla P4), changing image_per_batch 4  by running:
python projects/SparseRCNN/train_net.py
--config-file project/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml
--num-gpus 2 SOLVER.IMS_PER_BATCH 4
when it iter 7319, save the module and the AP of it is 3.915, which is different with your 11.440 (in your log).
Refer to detectron, I adjusted the learning rate to 0.0025 by running:
python projects/SparseRCNN/train_net.py
--config-file project/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml
--num-gpus 2 SOLVER.IMS_PER_BATCH 4 SOLVER.BASE_LR 0.0025
and change GPU to 1 by running:
python projects/SparseRCNN/train_net.py
--config-file project/SparseRCNN/configs/sparsercnn.res50.100pro.3x.yaml
--num-gpus 1 SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025
but the result was worse.
Later I found that they use SGD and you use AdamW, maybe this 0.0025 is not applicable,
So I want to know if I need to adjust some parameters. and how to adjust?
Thanks.

you should set BASE_LR as 0.000025 instead of 0.0025.

When first running it, the learning rate is default, i.e.0.000025, got a lower AP than the author's log, then I changed the learning rate.

you should set BASE_LR as 0.000025 instead of 0.0025.
When first running it, the learning rate is default, i.e.0.000025, got a lower AP than the author's log, then I changed the learning rate.

When first running it, the learning rate is default, i.e.0.000025, got a lower AP than the author's log, then I changed the learning rate.

When first running it, the learning rate is default, i.e.0.000025, got a lower AP than the author's log, then I changed the learning rate.

maybe you need a small lr than 0.000025

OK, thanks for your reply, I will try it now.

So, what changes have you made? I guess do I need to set lr as 0.000025 * 1/8 and total number of iterations 8 times? However, as the number of iterations increases, the entire training duration becomes extremely large


Fix fuse mount options and refactor path cache loader

What changes are proposed in this pull request?
PR 3 of Alluxio FUSE SDK https://github.com/Alluxio/alluxio/pull/16284
Fix passing the FUSE mount options and refactor path cache loader.
Why are the changes needed?
Fix the FUSE mount option issues.
Does this PR introduce any user facing changes?
NA

alluxio-bot, merge this please

alluxio-bot, merge this please


Removing code coverage support from debug builds.

Code coverage was unnecessarily pulling in jacoco classes into the debug build .aar, causing problems for several users.  This removes code coverage (which was not working properly, anyway), which will eventually be fixed in another build.

This change is

PTAL @roboerikg

Review status: 0 of 1 files reviewed at latest revision, all discussions resolved.

Comments from Reviewable

Review status: 0 of 1 files reviewed at latest revision, all discussions resolved.

Comments from Reviewable


Deploy Checklist: New Expensify 2022-12-27

Release Version: 1.2.44-0
Compare Changes: https://github.com/Expensify/App/compare/production...staging
This release contains changes from the following pull requests:

[ ] https://github.com/Expensify/App/pull/11837
[ ] https://github.com/Expensify/App/pull/13430
[ ] https://github.com/Expensify/App/pull/13456
[x] https://github.com/Expensify/App/pull/13693
[ ] https://github.com/Expensify/App/pull/13699
[ ] https://github.com/Expensify/App/pull/13708
[x] https://github.com/Expensify/App/pull/13734
[ ] https://github.com/Expensify/App/pull/13744
[ ] https://github.com/Expensify/App/pull/13748
[x] https://github.com/Expensify/App/pull/13754
[x] https://github.com/Expensify/App/pull/13783
[x] https://github.com/Expensify/App/pull/13790
[x] https://github.com/Expensify/App/pull/13791
[ ] https://github.com/Expensify/App/pull/13800
[ ] https://github.com/Expensify/App/pull/13827

Deployer verifications:

[ ] I checked the App Timing Dashboard and verified this release does not cause a noticeable performance regression.
[ ] I checked Firebase Crashlytics and verified that this release does not introduce any new crashes.

cc @Expensify/applauseleads

:rocket: All staging deploys are complete, @Expensify/applauseleads please begin QA on version https://github.com/Expensify/App/releases/tag/1.2.44-0 :rocket:

@chiragsalian  Regression is completed
https://github.com/Expensify/App/pull/13744#issuecomment-1366165792 (we are not able to verify transfer balance step and on Native apps adding new VBA is still blocked. Rest is pass)
https://github.com/Expensify/App/pull/11837 is failing https://github.com/Expensify/App/issues/13849. Seems expected based on comments, but pls double check if ok to check off

Yup checking off https://github.com/Expensify/App/pull/11837. It seems expected.
We tested transfer balance step https://github.com/Expensify/App/pull/13744#issuecomment-1366165792. Slack comment. Checking this off.

:shipit:


Dev geo

Support built-in function for Date

Date()
DateComponent()

Support fraction for DateTime: YYYY-MM-DDHH:MM:SSL.FFFFFF]

modify seconds since epoch to microseconds since epoch.
modify the datetime function and unit test.
you can specify the datetime by formatYYYY-MM-DD HH:MM:SS or YYYY-MMDD HH:MM:SS.FFFFFF
if the fraction part(microseconds)is zero, we won't transform the fraction part into string format.

 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.

 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.

还有CLA需要过下


Stories Widget

Summary
Web stories widget to add stories to registered sidebars.
Relevant Technical Choices
Web stories widget consist of mainly 4 fields.

Widget Title
View type for displaying stories in particular view format.
Togglable controls for displaying various fields in stories like Title, Author, Date etc.
Number of stories to display (Maximum 20).

Fixes: #33

Can you move assets/images/carousel-icon.png -> assets/images/widget/carousel-icon.png

Can you move assets/images/carousel-icon.png -> assets/images/widget/carousel-icon.png

Any update on this one @ankitrox

Any update on this one @ankitrox

I think we need to resolve the conflicts here with a rebase before I can code review again.

I think we need to resolve the conflicts here with a rebase before I can code review again.

Please make sure that all js lints and e2e are passing.

Please make sure that all js lints and e2e are passing.


First pr

Implement the Double-Metaphone algorithm, making several improvements along the way.

I guess so, but you're comparing it with a string anyway, so I think it's ok?

@swenson what do you think? does this look ok?

:lgtm:


Programmatically setting endpoint in scripts

Is there a way to programmatically create endpoints in scripts? I've been pasting endpoints into the UI and restarting manually thus far.

Before starting napari-imagej, you could do:
from napari_imagej import settings
settings.imagej_directory_or_endpoint = "sc.fiji:fiji:2.13.0+sc.fiji:SNT:MANAGED

The MANAGED keyword is a special jgo thing that means to leave off the version, trusting that a previously declared Maven coordinate (in this case, sc:fiji:fiji:2.13.0) has a dependencyManagement including sc.fiji:SNT. This increases the chances of declaring compatible versions of multiple components across a bill of materials.
What sorts of Java things do you need to do in your script? Can you get away with declaring everything you need in a single big endpoint declaration? Or do you need multiple incompatible classpaths? If you need multiple incompatible versions of things for different steps of your workflow, one possible solution might be dynamic class loading using Groovy Grape's @Grab or scijava-grab in SciJava scripts. But I have not heavily tested this.


Filter refactor, keep all callback methods inside Filter.Listener

related: https://github.com/apache/dubbo/pull/5639 #5623

Codecov Report

Merging #5731 into master will decrease coverage by 0.12%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #5731      +/-   ##
============================================
- Coverage     61.43%   61.31%   -0.13%
  Complexity      497      497
============================================
  Files           932      927       -5
  Lines         38098    37944     -154
  Branches       5500     5480      -20
============================================
- Hits          23405    23264     -141
- Misses        12149    12150       +1
+ Partials       2544     2530      -14

Impacted Files
Coverage Δ
Complexity Δ

...in/java/org/apache/dubbo/rpc/ListenableFilter.java
0% <ø> (ø)
0 <0> (ø)
:arrow_down:

...rg/apache/dubbo/monitor/support/MonitorFilter.java
67.34% <100%> (ø)
0 <0> (ø)
:arrow_down:

...ava/org/apache/dubbo/rpc/filter/TimeoutFilter.java
58.33% <100%> (ø)
0 <0> (ø)
:arrow_down:

...ache/dubbo/rpc/protocol/ProtocolFilterWrapper.java
68.51% <100%> (-1.13%)
0 <0> (ø)

...org/apache/dubbo/rpc/filter/ActiveLimitFilter.java
87.23% <100%> (ø)
0 <0> (ø)
:arrow_down:

.../org/apache/dubbo/rpc/filter/CompatibleFilter.java
54.54% <100%> (ø)
0 <0> (ø)
:arrow_down:

...ava/org/apache/dubbo/rpc/filter/GenericFilter.java
43.47% <100%> (ø)
0 <0> (ø)
:arrow_down:

.../dubbo/rpc/protocol/dubbo/filter/FutureFilter.java
17.7% <100%> (ø)
0 <0> (ø)
:arrow_down:

...rg/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
65.21% <100%> (ø)
0 <0> (ø)
:arrow_down:

...ava/org/apache/dubbo/rpc/filter/ContextFilter.java
93.18% <100%> (ø)
0 <0> (ø)
:arrow_down:

... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60e72bf...b4a8977. Read the comment docs.


[enhancement]: Folders, different views, batch select files/folders and the ability to rename images (eg: Windows 11/10)

Is there an existing issue for this?

[X] I have searched the existing issues

Contact Details
No response
What should this feature add?

Folders inside of images and assets tabs I know there are boards, but I would like to be able to create folders inside of boards so that I can store my upscaled images separately in the same board.
I would also like to have different view in images and assets tabs like details in windows.
I would also like the ability to batch select images with mouse drag.
I would also like to rename images in images tab and in assets tab and also when generating an image so I don't have to manually rename an image after generating the image

Alternatives
Windows 11/10
Additional Content
This is for the details view two views should be fine one large icons and other details

And this is for the batch select

And this is for the rename

Let me Board-Folders as well.
Boards are awesome, and Archives are a good idea, but since "out of sight, of mind" I'd rather like to group my Boards depending on things like Model used or theme. Then I'd create a FLUX-Folder for example or a Folder for a Project with a Board per character of said project etc.
I haven't been using Invoke for that long and my list of Boards is already really long.
This would be much appreciated.


[android][platform view] Janky Animation

Animating a Platform View widget is janky.
Tested on latest stable and master 3.8.0-5.0.pre.1, android 12SKQ1.211006.001, xiaomi mi lite 11  5G.
Steps to Reproduce
Please run this simple example here:
https://github.com/delfme/flutter-native-text-input-repo
Expected results:
When opening keyboard, native widget should animate smoothly.
Actual results:
Native widget animation is janky.
https://user-images.githubusercontent.com/53510751/218093471-c8eee90e-0b8e-491e-84a6-9f4186353c61.MP4
Flutter doctor:

[✓] Flutter (Channel master, 3.8.0-5.0.pre.1, on macOS 12.2 21D49 darwin-arm64, locale en-IT)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Thanks for the report @delfme
Can you please enable performancOverlay and see if you get shader jank while opening the keyboard ?
Also, is that the default device keyboard or external one such as Gboard ?

@darshankawar here is the performanceOverlay. We have red frames when widget is rendered and on first keyboard opening. Then we can't observe red frames but animation is still jittery.
cc: @jonahwilliams might this be the android equivalent of #120555 ?
https://user-images.githubusercontent.com/53510751/218411532-5fb031f6-850c-4bc9-8a51-55fa5e374dbc.mov

Thanks for the update @delfme. The similar issue you linked states that it may not be related to platform-views https://github.com/flutter/flutter/issues/120555#issuecomment-1428387351.
Since this issue could also be related, although trying to S10 device, the jank I observed was  not consistent and sometimes smooth with animation and the jank wasn't noticeable mostly.
Is it possible to confirm without adding native textfield and check if the animation is still janky on the device you used ?
https://github.com/delfme/flutter-native-text-input-repo/blob/d18841e1a0542e8fbe70dff463cade69448b1d7e/lib/demo_screen.dart#L99

I will try to look into this. Indeed it seems that issue may not be due to platform view https://github.com/flutter/flutter/issues/120555#issuecomment-1429871820
Can you also help with this? By disabling lines 98-
131 and enabling 134-151 we can debug the issue with flutter textfield.
https://github.com/delfme/flutter-native-text-input-repo/blob/d18841e1a0542e8fbe70dff463cade69448b1d7e/lib/demo_screen.dart#L98

I tried as above, although I see some jank in performance overlay, the animation jank while opening the keyboard is not noticeable as it opens pretty smoothly on S10 atleast I tried on.
I'll keep this issue open for team's attention and for better tracking.

@darshankawar janks/jittery occurs randomly yet consistently. On my Xiaomi Mi Lite 11 is much evident. It might not be wrong animation curve. Right now we are debugging same issue on iOS and it seems to be caused by flutter engine, we saw GC and raster getting stuck waiting.
If flutter team can work on this, the discovery on other issue should be helpful, or else we will try to have a look at this after iOS fix

Linking here the unsync keyboard issue coz the two issues might be intertwined.
https://github.com/flutter/flutter/issues/116836


robot.screen.capture results in blank image

calling robot.screen.capture() or robot.screen.capture(0,0,1920,1080) and saving to disk results in a blank(all black) image of correct dimensions.

Expected Behavior
it should capture the desktop and provide a valid image

Current Behavior
it creates a valid size but all black image.

Possible Solution

Steps to Reproduce (for bugs)

`var screenCaptureToFile = function(path) {
return new Promise((resolve, reject) => {
 try {

     var picture = robot.screen.capture(0,0,100,100);

     var image = new jimp(picture.width, picture.height, function(err, img) {

         img.bitmap.data = picture.image;

         img.getBuffer(jimp.MIME_PNG, (err, png) => {

             image.write(path, resolve);

         });

     });

 } catch (e) {

     console.error(e);

     reject(e);

 }

})`

call screenCaptureToFile('test.png')

open result test.png to find correct dimensions but all black

Context
I'm running an express website where a user clicks a button to save the servers desktop screenshot so it can be further processed and then served. I've tried running it via nodemon, sudo nodemon, npm start, sudo npm start. Nothing seems to be working. It appears as though the capture desktop function doesnt work with my current setup.

Your Environment

RobotJS version:  not sure
Node.js version: 8.2.1
npm version: 6.10.1
Operating System: Kubuntu 18.04lts ..  i3wm, plasma/kde, mate, cinnamon ... x11

Hey,
I tried this according to the docs:
const r = require('robotjs');
const Jimp = require('jimp');
const uuid = require('uuid/v4');

const swapRedAndBlueChannel = bmp => {
  for (let i = 0; i < (bmp.width * bmp.height) * 4; i +=4) { // swap red and blue channel
    [bmp.image[i], bmp.image[i+2]] = [bmp.image[i+2], bmp.image[i]]; // red channel
  }
};

const screen = async f => {
  const bmp = r.screen.capture(1537,66,1016,631);
  swapRedAndBlueChannel(bmp); // possible side effect using a pointer here
  const img = new Jimp({data: bmp.image, width: bmp.width, height: bmp.height});
  img.write(`out/${f}-${uuid()}.jpg`);
};

screen('bob');

This works for me

If you're using MacOS I would suggest using the native screen capture. It's much more efficient, plus you have tons of options such as record video. Run screencapture -help to see the list.
I was converting 400x600 screen captures using robotjs and jimp to save a file at around 45 seconds. Using screen capture was instant.
This is what worked for me, and there are other ways to interact with terminal as well.
const shell = require('shelljs'); // -R flag to define coordinates  shell.exec('screencapture -R 0,0,400,600 ~/dev/bot/test2.png');

Probably should add, from what I understand the capture method on robot JS creates the bit map, and you need to get the color from each pixel and assign it to the image you create. Hence why it takes a while to build an image when its larger.
`
let jimg = new Jimp(w, h);
for (let x = 0; x < w; x++) {
for (let y = 0; y < h; y++) {

	stamp = Date.now();

    // hex is a string, rrggbb format

    let hex = rimg.colorAt(x, y);

    // Jimp expects an Int, with RGBA data,

    // so add FF as 'full opaque' to RGB color

    let num = parseInt(hex+"ff", 16)

    // Set pixel manually

    jimg.setPixelColor(num, x, y);

}

}
`

It looks like this issue has been resolved, closing.
You may reopen this issue if it has been closed in error.


nixos-install and absolute paths in configuration.nix

Issue description
I'm not sure if this is really considered an issue, or if it's a new one, but I think it's very painful that nixos-install from the 17.09 installer (and perhaps before that, too?) will not simply work if I muck up my system and try to rescue it by mounting my root tree and running nixos-install from the iso. If, for instance, hardware-configuration.nix is imported with an absolute path relative to the new root (that is, /mnt in the installer) it fail importing. Would it be possible for all of this to occur in a chroot or a similar method, so that any mix of relative and absolute paths in configuration.nix will not bother the installer?

Not relevant to me anymore.


Change the placement of 'Repository Information' icon with '+Create' button

What is this PR for?
I just changed the Repository Information icon placement with +Create button in Interpreter setting page, since the tooltip is not shown properly.
What type of PR is it?
Improvement
Todos

[x] - Change the icon placement

What is the Jira issue?
No
How should this be tested?
After applying this PR and go to interpreter setting page. Then hover the mouse on the gear icon. That's it :)
Screenshots (if appropriate)

Before

After

Questions:

Does the licenses files need update? No
Is there breaking changes for older versions? No
Does this needs documentation? No

@AhyoungRyu
If tooltip display is the only issue you can try other placement properties
tooltip-placement="left"
otherwise LGTM 👍

@r-kamath Right that would be also a possible way :) But then the tooltip will hide +Create button, so I just switched them.

LGTM

Merging this if no more discussion.


Prepare README for open telemetry repo

Updated the project description for OpenTelemety. Also attempted to clarify the different components in the project ({kernel,k8s,cloud}-collector and reducer)
Added "Contributing" section, using as template a similar PR from opamp. After pushing to the open telemetry repo, I'll add a similar PR to add @bjandras and @jimwsplk as maintainers.

I'm good with proposed changes, although I can spot more places in the README that need editing.

thanks for the review @bjandras ! we should probably revisit the README in the coming weeks (at least after porting the reducer)..


Loaded tab is empty unless REPL is opened

Probably should be showing some watermark

Send to JP for load balance if needed


Nova Resources

Need to update them to correctly reference the $userResource like this example:
https://github.com/vyuldashev/nova-permission/blob/master/src/Permission.php

This looks like a better way to reference the user model:

https://stackoverflow.com/questions/40764287/laravel-5-moved-user-model-to-app-models-causing-autoload-issues


Insert Issue

Hey
I copied the code from the Insert Example:
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
const jobs = [];
const jobTypes = [ 'A', 'B', 'C', 'D' ];
function addJobs(quantity) {
const startId = jobs.length;
for (let i = 0; i < quantity; i++) {
const id = startId + i;
jobs.push({
id: id,
name: 'Item name ' + id,
type: 'B',
active: i % 2 === 0 ? 'Y' : 'N'
});
}
}
addJobs(5);
export default class DataInsertTypeTable extends React.Component {
render() {
return (
<BootstrapTable data={ jobs } insertRow={ true }>
<TableHeaderColumn dataField='id' isKey={ true }>Job ID
<TableHeaderColumn dataField='name' editable={ { type: 'textarea' } }>Job Name
<TableHeaderColumn dataField='type' editable={ { type: 'select', options: { values: jobTypes } } }>Job Type
<TableHeaderColumn dataField='active' editable={ { type: 'checkbox', options: { values: 'Y:N' } } }>Active

);
}
}
And when I try to run it, I can't use the insert button.  I'm running:
"jquery": "^3.1.0",
"react": "^0.14.6",
"react-bootstrap-table": "^2.5.0",
"bootstrap": "^3.3.7",

Any idea why it wouldn't work?
Thanks
Docmur

And when I try to run it, I can't use the insert button

is mean the insert modal is not popup?

I had the same issue that the modal wasn't appearing but it turned out that I was only loading the CSS and not the js-file. Hope this helps.

Got it to work, was a JavaScript issue in the index.html file, so thanks :)


Cloud Datastore Emulator Can't Find Java on Mac

## Sorry, you can delete this issue, it is not related to here. Posting on stackoverflow
Environment details

OS: macOS 10.12.6
Node.js version: 8.9.0
npm version: 5.5.1

Steps to reproduce
running gcloud beta emulators datastore start produces error:
ERROR: (gcloud.beta.emulators.datastore.start) The java executable on your PATH is not a Java 7+ JRE. The Google Cloud Datastore emulator requires a Java 7+ JRE installed and on your system PATH
the problem is, I do have java installed. When running java -version I get:
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
I reinstalling java and rebooting, nothing works
Any help?

Feel free to link the question / come back with the answer in case anyone else runs into the same problem.

For me it works with Java 9
Managed to fix it by uninstalling java and datastore emulator, and reinstalling it again, and restarting the machine after each action (an old fashion fix)

Same problem here on Fedora, java -version reports:
openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)

Definitely seems to be something wrong with the Java runtime detection.


Ctrl-\ kill elvish itself

~> sleep 100<Enter><Ctrl-\>

Then the terminal tab is closed.

@huiyiqun I think it is by design...

I guess it's a misfeature.

It's a bug. Ctrl-\ sent while external commands are running should not kill elvish; those sent when elvish editor is active should.

This issue is caused by a lack of job control (#410) and the handling of SIGQUIT (#441). They are now tracked in their own issues.


Feature Request: Add ability to force mobile responsive view or customize width on desktop

Running into an interesting problem here where our preferred design when using Plaid link would be to have the modal appear in a specific location on screen e.g. this is the view we are trying to achieve in our new Expensify app:

However, the underlying styling for the Plaid Link UI is happening inside an iframe and we cannot modify these styles. We managed to get around this by ditching react-plaid-link in favor of another iframe loading the regular JavaScript sdk, but it's not very ideal and also looks more like this than the desired look:

Is there any suggestion for how to work around this limitation? Are the mobile responsive views returned when using a mobile user agent and not based on parent screen width? Assuming that is the case here and what prevents us from customizing this further.
It would be great if we could:

Force the mobile responsive view somehow
Add more options to customize the width + shadow of the Plaid UI

This view works great for us on mobile web, but creates a jarring experience for our desktop users.

hey @marcaaron, this is an interesting request. There may be some ways to hack around the iframe styling (as you experimented with in the linked PR) but I don't recommend it. Either way react-plaid-link is not going to support this so I am going to close this issue.


ImageClassificationExplainer: AttributeError: ndim when trying to visualize.

Hi,
I am trying to run the notebook that you provided but when it comes to visualizing, there is an attribute error.

How can I solve this?

I have the same problem when playing with the exemplary code
`from transformers import AutoFeatureExtractor, AutoModelForImageClassification
from transformers_interpret import ImageClassificationExplainer
from PIL import Image
import requests
model_name = "google/vit-base-patch16-224"
model = AutoModelForImageClassification.from_pretrained(model_name)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
With both the model and feature extractor initialized we are now able to get explanations on an image, we will use a simple image of a golden retriever.
image_link = "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F47%2F2020%2F08%2F16%2Fgolden-retriever-177213599-2000.jpg"
image = Image.open(requests.get(image_link, stream=True).raw)
image_classification_explainer = ImageClassificationExplainer(model=model, feature_extractor=feature_extractor)
image_attributions = image_classification_explainer(
image
)
print(image_attributions.shape)
image_classification_explainer.visualize(
method="heatmap",
side_by_side=True,
outlier_threshold=0.03
)`

Do you know the solution to this error?

Hi, I encountered the same error, it seems that transformers library doesn't work with PIL. Changing line 69 in transformers_interpret/explainers/vision/image_classification.py to this:
self.feature_extractor.resize(np.array(self._image), size=(attributions_t.shape[0], attributions_t.shape[1]))
worked in my case.


support router addition

Codecov Report

Merging #207 (102cb0f) into v2.2.0 (d0e9ccc) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           v2.2.0     #207      +/-   ##
==========================================
- Coverage   68.07%   68.05%   -0.02%
==========================================
  Files          71       71
  Lines        5077     5078       +1
==========================================
  Hits         3456     3456
- Misses       1170     1171       +1
  Partials      451      451

Impacted Files
Coverage Δ

server/sync_server.go
0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0e9ccc...102cb0f. Read the comment docs.


Makefile Header

Plugin doesn't support Makefiles

Yes it's a known limitation, any file type that does not have C comments is not supported, I will try to fix it as soon as possible. At least putting a header in the Makefile is not required by the norm 😛

The update should be available next week.


Troubles with IE 11 style property flex: 1 1 0px

First thank you for all your hard work on this project.  It has been extremely helpful in keeping one code base and being productive.
I have a simple class that generates a margin.  It does not display in IE 11 but works well in Chrome, Safari, and FireFox.   In ie 11 (version 11.0.9600.18378) the style property that is generated is "flex: 1 1 0px;"  This  0px stops the view from displaying.  If I manually inspect the element and change it to "flex: 1 1 auto" everything works fine.
In chrome the flex style become flex:1 1 0% and displays perfectly.  It also works great in firefox and safari.
Any ideas on what is going on with IE?
Thank you in advance for your help.
Respectfully,
Bret
Class code (element snapshot below):
var hedgeCount = 0;
var _globalWidth = APP.FeedWidth;

export default class marginView extends TimerBaseClass
{
    constructor(props)
    {
      super(props);
      this.props = props;
    }

    static set GlobalWidth(width) {
      _globalWidth = width;
    }

    render()  {
        let key = "marginView" + hedgeCount;
        hedgeCount += 1;
        console.log( "gobalWidth = "  + _globalWidth );
        return (
                <View key={key} style={[styles.container,{width:_globalWidth}]}>
                  <View style={[styles.borderLine,{width:_globalWidth}]}/>
                  <View style={[styles.margin,{width:_globalWidth}]}/>
                </View>
        )
    }

    genStyle() {
      styles = StyleSheet.create({
          container : {
            flex : 1,
            alignItems : 'flex-start',
            flexDirection : 'column',
          },
          borderLine : {
                  backgroundColor : APP.colorGray,
                  height : 1,
          },
          margin : {
                height : 10,
                backgroundColor : APP.colorLightGray,
          },
      });
    }
}

Original generated code in IE:

After changing 0px in flex to auto in IE everything is good.

One more piece of info if I change the flex property to flex : "1 1 auto"
my margin renders correctly in all browsers.
Any ideas on what syntax I should use for the flex property?
Thank you again,
b
genStyle() {
      styles = StyleSheet.create({
          container : {
            **flex : "1 1 auto",**  // this works instead of flex
            alignItems : 'flex-start',
            flexDirection : 'column',
          },
          borderLine : {
                  backgroundColor : APP.colorGray,
                  height : 1,
          },
          margin : {
                height : 10,
                backgroundColor : APP.colorLightGray,
          },
      });

That maybe a bug when use flex: 1 1 0

Agreed that is the bug in IE.  But where is the best place to handle this?
e.g. Could we put it in a lower level of react-web to check for browser type?
I am handling it like this for now until there is a fix.
container: {
             flex : Utils.ieFlex1(),
              flexDirection : 'column',
              justifyContent: 'center',
              alignItems: 'center',
              backgroundColor : APP.colorWhite, // if not clear text objects will have color
              height : APP.deviceHeight,
              display: APP.FeedWidth + 30 ,
          },

Then i have a static function:
  static ieFlex1() {
     if ( !ieChecked ) {
         Utils.isIE();
         if ( ieTrue ) {
           console.log("RUNNING IN IE");
         }
     }
     return (ieTrue > 0) ? "1 1 auto" : 1 ;
   }

But I am hoping that we may hide this code in react-web and just use flex :1
Thank you again for your help.


[Documentation]: Polar area chart: Missing array specification.

Documentation Is:

[x] Missing or needed

Please Explain in Detail...
The documentation under https://www.chartjs.org/docs/latest/charts/polar.html lacks the information that the fields backgroundColor, borderColor, borderWidth, hoverBackgroundColor, hoverBorderColor and hoverBorderWidth can be arrays.
Your Proposal for Changes
Like for data: number[], add an array descriptor to the type column.
Example
https://jsfiddle.net/ekc83w5f/
Basically the same as https://github.com/chartjs/Chart.js/pull/6450, but for the polar area chart.

Closing this, for more information see https://github.com/chartjs/Chart.js/pull/6450#issuecomment-520950454.


gluster-block provisioner creates CHAP secret in any namespace

Since iSCSI PV references CHAP secret in the Pod's (or Claim's) namespace. gluster-block thus tries to create secret in any namespace. This will bring risk if gluster-block provisioner is compromised and overrides secrets used by kubernetes.
@liggitt

more importantly, it exposes and gives control over the CHAP secret to the PVC-creating user, when the details of that should be hidden from them

Thanks @rootfs , I will adopt the changes in the provisioner once the iscsi pv spec is in . Also reviewing your refactor ISCSI PV PR.

/assign @rootfs

/assign @humblec


Made installation script distro-independent.

Feature:

Made installation script work on most common Linux distributions. Previously it only worked on Redhat linux/ Fedora.

Bug:

Fixed the bug #373, where anaconda was being reinstalled without checking if it is already installed.

This is cool. Thanks for the contribution, @rumbleFTW. Merged to dev.


Rewrite detector to read and understand new trace

[x] isolate the detector
[x] read the trace
[x] transform the trace into detector trace
[ ] rewrite detector to work with changed trace

[ ]  rewrite mutex detection
[ ] rewrite channel detection


Dragging the color picker is slow

https://youtu.be/O9o-1RtOvWg

The video does not lead to a screen recording of the app, it's a MIDI video of Still Alive from Portal. Please send the correct video of this happening and I'll look into this issue

Whoops lol.
https://github.com/Gold872/elastic-dashboard/assets/105223895/975e085b-87bc-430c-b40a-2fc0bea36ecc

The color picker was rebuilding the entire widget tree every time the color was changed. I'm changing it so that it only updates when you click "Save"


Controller becomes unresponsive when trying to remove dead node

I have one node that is dead that I'm unable to remove. When attempt to remove it, the controller locks up and becomes unresponsive for a at least a few minutes, sometimes longer. If I wait a while then usually the controller will start working again on it's own. I think this leads to side affects like half my node's statuses being unknown in Home Assistant after updating zwavejs2mqtt until I ping all them.
Here is what I see in the debug logs:
2022-05-10 14:17:43.000 INFO ZWAVE: Calling api removeFailedNode with args: [ 37, [length]: 1 ]
2022-05-10T19:17:43.003Z CNTRLR » [Node 037] pinging the node...
2022-05-10T19:18:48.029Z CNTRLR [Node 037] ping failed: Timeout while waiting for a callback from the controll
er (ZW0200)
2022-05-10T19:18:49.037Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:18:50.143Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10T19:18:53.249Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:18:54.352Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10T19:18:56.456Z CNTRLR [Node 006] did not respond after 1/3 attempts. Scheduling next try in 500 ms.
2022-05-10T19:18:57.962Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:18:59.069Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10T19:19:01.178Z CNTRLR [Node 006] did not respond after 2/3 attempts. Scheduling next try in 500 ms.
2022-05-10T19:19:02.684Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:19:03.785Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10 14:19:05.893 ERROR ZWAVE-SERVER: Timeout while waiting for an ACK from the controller (ZW0200)
ZWaveError: Timeout while waiting for an ACK from the controller (ZW0200)
at Driver.sendMessage (/opt/node_modules/zwave-js/src/lib/driver/Driver.ts:3449:23)
at Driver.sendCommand (/opt/node_modules/zwave-js/src/lib/driver/Driver.ts:3623:28)
at MultilevelSwitchCCAPI.get (/opt/node_modules/zwave-js/src/lib/commandclass/MultilevelSwitchCC.ts:114:22)
at MultilevelSwitchCCAPI.<computed> (/opt/node_modules/zwave-js/src/lib/commandclass/MultilevelSwitchCC.ts:417:24)
at ZWaveNode.pollValue (/opt/node_modules/zwave-js/src/lib/node/Node.ts:1017:15)
at Function.handle (/opt/node_modules/@zwave-js/server/dist/lib/node/message_handler.js:51:36)
at Object.node (/opt/node_modules/@zwave-js/server/dist/lib/server.js:40:91)
at Client.receiveMessage (/opt/node_modules/@zwave-js/server/dist/lib/server.js:96:99)
at WebSocket.<anonymous> (/opt/node_modules/@zwave-js/server/dist/lib/server.js:49:45)
at WebSocket.emit (node:events:526:28)
2022-05-10T19:19:06.908Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:19:08.012Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10 14:19:10.119 INFO ZWAVE: Timeout while waiting for an ACK from the controller (ZW0200) removeFailedNode undefined
2022-05-10T19:19:11.134Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:19:12.237Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.
2022-05-10T19:19:14.340Z CNTRLR [Node 020] did not respond after 1/3 attempts. Scheduling next try in 500 ms.
2022-05-10T19:19:15.847Z CNTRLR Failed to execute controller command after 1/3 attempts. Scheduling next try i
n 100 ms.
2022-05-10T19:19:16.951Z CNTRLR Failed to execute controller command after 2/3 attempts. Scheduling next try i
n 1100 ms.

Please make a driver log, loglevel debug or silly and attach it here as a file.

Okay, that's one I haven't seen before. The entire stick becomes unresponsive when trying to ping the node during the startup procedure. When you attempt to remove it, it is already too late. Unfortunately, there's no way to disable the pinging, since it determines the node status. Manually editing the controller memory is out of the question since your stick firmware is too old.
If you have access to a Windows PC, you can try to remove the node using Silabs' PC controller (part of Simplicity Studio).


Performance Improvement

Currently Improvements
The average Latency could be decreased by 165,49855 % (from 759,14us to
285,93us).
The average Request/s improved by 62,057821 % (from 2620,34 req/s to 6906,14
req/s).
Benchmark Raw Data
Added the improvements in percentage (-n % is good in Latency!)
With strip_debug
Statistics        Avg      Stdev        Max
  Reqs/sec      6906,14     612,30    7957,42
  Latency      285,93us   171,41us    27,91ms
  Latency Distribution
     50%   257,00us   (-58,593750 %)
     75%   309,00us   (-60,517799 %)
     90%   376,00us   (-66,755319 %)
     95%   440,00us   (-70,909091 %)
     99%   764,00us   (-2839,9464 %)
  HTTP codes:
    1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    15.05MB/s

Without strip_debug
Statistics        Avg      Stdev        Max
  Reqs/sec      2620,34    1478,93    5612,99
  Latency      759,14us     2,42ms    33,50ms
  Latency Distribution
     50%   406,00us
     75%   496,00us
     90%   627,00us
     95%   752,00us
     99%    21,95ms
  HTTP codes:
    1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     5.57MB/s

The average Latency is improved – by the latest Patches – by 55,49855 % and the req/s by 10,057821 %

@rimusz or @jainishshah17 can you please re-review the Changes?

@l0nax can you please resolve the conflicts, thanks

Yes I will push the Changes today

@rimusz Merge Conflict resolved


Few Question in using devzat

The picture that shows in terminal have a really unclear look, can we make it looks more clearer?and also sometimes sending markdown picture would do no shit like the picture doesnt even show in the terminal,whichi should be the the connection error or ish.
e.g.

it looks even worse in phone

is there any way that we can save the messages that ever showed up in the chatroom into a log file like chat.log? i often can't catch up with my friends.

Hey, sorry for the late response.
Unfortunately the pictures are blurry because we are still limited by the text interface that a terminal is. Each pixel is actually a unicode character colored with ANSI color codes.
Sometimes pictures may not show up if they are too big (file size or dimensions)
There's a few ways you could enable chat logging. If you connect Devzat to a Discord server, all your messages will be posted there and you pretty much have a complete log on Discord. You could also make a devzat plugin in javascript, rust or go that saves all messages. Let me know if you want details on that.


getResourceDrawable not accessible after 3.5.0 upgrade (from 3.4.1)

Steps to reproduce:

setup a project using 3.4.1 and access getResourceDrawable it will build
upgrade to 3.5.0 function is not visible any more (still there in the code though)

Observed Results:
function is not found
Expected Results:
function should be accessible, visibility hasn't changed
Relevant Code:
// code here

PR with reproduction on Sample App

See: [#](https://github.com/KakaoCup/Kakao/pull/106/files)

3.5.0 ContextUtillsKt
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available

package io.github.kakaocup.kakao.common.utilities

public fun<EMAIL_ADDRESS>resId: kotlin.Int): kotlin.Int { /* compiled code */ }

public fun<EMAIL_ADDRESS>resId: kotlin.Int): android.graphics.drawable.Drawable? { /* compiled code */ }

public fun<EMAIL_ADDRESS>resId: kotlin.Int): kotlin.String { /* compiled code */ }

@sebastienrouif thanks for reporting. Will try to fix in the next release

Looks like issue related for Gradle configuration when functions declared without explicit classes
ContextUtills.kt
...

fun getResourceDrawable(@DrawableRes resId: Int) =
    ContextCompat.getDrawable(InstrumentationRegistry.getInstrumentation().targetContext, resId)

...

Classes not found
However if
...
object ContextUtils {
...
fun getResourceDrawable(@DrawableRes resId: Int) =
    ContextCompat.getDrawable(InstrumentationRegistry.getInstrumentation().targetContext, resId)

...
}

All works as expected

#112 + #114 should fix the issue

#106


Bulk Data File Download Issues - Firefox and Safari. (RT 73520)

Two screenshots are attached that show errors that result in the number of expected downloads not equaling the actual downloads
Unable to download bulk files from safari and Firefox browser.

Research details:
X-Frame-Options is a header included in the response to the request to state if the domain requested will allow itself to be displayed within a frame. It has nothing to do with javascript or HTML, and cannot be changed by the originator of the request.
This website has set this header to disallow it to be displayed in an iframe. There is nothing that can be done in a client-side web browser to stop this behaviour.(link)

In CAMPD UI using iframe for downloading zip files (link).
Inside the iframe we cannot set X-Frame-Options.
I tried with anchor tag <a> with target = “_blank” I can be able to download in safari browser, but when I download new table will open and it will not close automatically.
And I tried with iframe using open URL (https://getsamplefiles.com/download/zip/sample-1.zip) then I can download file.
I think we need to change the policy of download URL for downloading.

@shahbazkhan1999
PR: https://github.com/US-EPA-CAMD/easey-campd-ui/pull/626

Tested staging in Firefox and Safari. The correct number of files seem to be downloading. Moved to Ready for deployment.


Navbar Redesign

Hi @rishicds
I would like to redesign the Navbar and make it responsive, and add language features into it. Please assign me this issue so that I can start working on it, as soon as possible.

Assigned

Hi @rishicds
This is the final design for navbar , shall I launch PR for it ?

Hi @rishicds , this is the current design. Any further more modifications ?


KC-1603: Update versions to fix multiple CVEs

Fixes some of the CVEs reported in https://confluentinc.atlassian.net/browse/KC-1603
io.confluent:confluent-log4j:1.2.17-cp2
httpclient: "4.5.13"
jetty: "9.4.40.v20210413"
jersey: "2.34"
mavenArtifact: "3.8.1"
reflections: "0.9.12"
zookeeper: "3.4.14"
Committer Checklist (excluded from commit message)

[ ] Verify design and implementation
[ ] Verify test coverage and CI build status
[ ] Verify documentation (including upgrade notes)

Please make similar changes to 2.3 and also ce-kafka. Thanks a lot.


Enhancement: Support for HuggingFace Self-Served TGI Serving with Updated Dependencies and Improved AI Handler

Type
Enhancement

Description
This PR introduces support for HuggingFace self-served TGI serving and makes several enhancements to the AI Handler. The main changes include:

Added a new attribute api_base to the AIHandler class.
Modified the chat_completion method to include api_base in the acompletion call.
Adjusted the chat_completion method to add prefixes and suffixes to system and user messages based on the configuration.
Handled the case where the model is not found in the MAX_TOKENS dictionary in get_max_tokens function.
Updated the openai version from 0.27.8 to 1.3.5 and litellm version from 0.12.5 to 1.7.1 in the requirements.txt file.
Replaced the import of TryAgain from openai.error to tenacity.

PR Files Labels

Relevant Files

Enhancement
files:pr_agent/algo/ai_handler.pypr_agent/algo/utils.py

Dependency Updates
files:requirements.txt

Error Handling
files:pr_agent/algo/ai_handler.py

Configuration
files:pr_agent/algo/ai_handler.py

Refactoring
files:pr_agent/algo/ai_handler.pypr_agent/algo/utils.py

/improve --pr_code_suggestions.summarize=true

/review

/review -i

@CodiumAI-Agent /review

/describe

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

/review

Preparing review...

Persistent review updated to latest commit https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9

Preparing review...

Persistent review updated to latest commit https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9

Preparing review...

Persistent review updated to latest commit https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9

Preparing suggestions...

PR Code Suggestions
💡 Suggestion:
Instead of using the get_settings() function multiple times, consider storing the settings in a variable and reusing it.
File: pr_agent/algo/ai_handler.py (30-60)
  Example code:

Existing code:
if get_settings().get("OPENAI.KEY", None):
    openai.api_key = get_settings().openai.key
    litellm.openai_key = get_settings().openai.key
if get_settings().get("HUGGINGFACE.KEY", None):
    litellm.huggingface_key = get_settings().huggingface.key
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
settings = get_settings()
if settings.get("OPENAI.KEY", None):
    openai.api_key = settings.openai.key
    litellm.openai_key = settings.openai.key
if settings.get("HUGGINGFACE.KEY", None):
    litellm.huggingface_key = settings.huggingface.key
if settings.get("HUGGINGFACE.API_BASE", None) and 'huggingface' in settings.config.model:
    litellm.api_base = settings.huggingface.api_base
    self.api_base = settings.huggingface.api_base

💡 Suggestion:
Instead of concatenating strings using '+', consider using f-strings for better readability.
File: pr_agent/algo/ai_handler.py (112-115)
  Example code:

Existing code:
system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
         get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
       get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")

Improved code:
system = f"{get_settings().get('CONFIG.MODEL_SYSTEM_PREFIX', '')}{system}{get_settings().get('CONFIG.MODEL_SYSTEM_SUFFIX', '')}"
user = f"{get_settings().get('CONFIG.MODEL_USER_PREFIX', '')}{user}{get_settings().get('CONFIG.MODEL_USER_SUFFIX', '')}"

💡 Suggestion:
Instead of using the get_settings() function multiple times, consider storing the settings in a variable and reusing it.
File: pr_agent/algo/utils.py (378-380)
  Example code:

Existing code:
settings = get_settings()
max_tokens_model = MAX_TOKENS.get(model, 4000)
if settings.config.max_model_tokens:
    max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

Improved code:
settings = get_settings()
max_tokens_model = MAX_TOKENS.get(model, 4000)
if settings.config.max_model_tokens:
    max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

💡 Suggestion:
Keep the dependencies in the requirements.txt file sorted alphabetically. This makes it easier to find a dependency and see its version at a glance.
File: requirements.txt (5-25)
  Example code:

Existing code:
openai==1.3.5
...
litellm==1.7.1

Improved code:
litellm==1.7.1
...
openai==1.3.5

Preparing PR description...

PR Description updated to latest commit (https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9)

Preparing review...

Persistent review updated to latest commit https://github.com/Codium-ai/pr-agent/commit/5d9c767254cb1bcb60ad846a0e5a748ea0f747d9

Preparing suggestions...

PR Code Suggestions
💡 Suggestion:
Avoid hardcoding the default max tokens value in the get_max_tokens function. Instead, define it as a constant at the top of the file.
File: pr_agent/algo/ai_handler.py (375-380)
  Example code:

Existing code:
def get_max_tokens(model):
    settings = get_settings()
    max_tokens_model = MAX_TOKENS.get(model, 4000)
    if settings.config.max_model_tokens:
        max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

Improved code:
DEFAULT_MAX_TOKENS = 4000

def get_max_tokens(model):
    settings = get_settings()
    max_tokens_model = MAX_TOKENS.get(model, DEFAULT_MAX_TOKENS)
    if settings.config.max_model_tokens:
        max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

💡 Suggestion:
Use f-string for string concatenation in the chat_completion function for better readability.
File: pr_agent/algo/ai_handler.py (112-115)
  Example code:

Existing code:
system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
         get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
       get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")

Improved code:
system = f"{get_settings().get('CONFIG.MODEL_SYSTEM_PREFIX', '')}{system}{get_settings().get('CONFIG.MODEL_SYSTEM_SUFFIX', '')}"
user = f"{get_settings().get('CONFIG.MODEL_USER_PREFIX', '')}{user}{get_settings().get('CONFIG.MODEL_USER_SUFFIX', '')}"

💡 Suggestion:
Use a more specific exception instead of the generic Exception in the chat_completion function.
File: pr_agent/algo/ai_handler.py (131-133)
  Example code:

Existing code:
except Exception as e:
    get_logger().error("Unknown error during OpenAI inference: ", e)
    raise TryAgain from e

Improved code:
except (SomeSpecificException) as e:
    get_logger().error("Specific error during OpenAI inference: ", e)
    raise TryAgain from e

💡 Suggestion:
Use a more descriptive variable name than e for exceptions in the chat_completion function.
File: pr_agent/algo/ai_handler.py (125-133)
  Example code:

Existing code:
except (APIError, TryAgain) as e:
    get_logger().error("Error during OpenAI inference: ", e)
    raise
except RateLimitError as e:
    get_logger().error("Rate limit error during OpenAI inference: ", e)
    raise
except Exception as e:
    get_logger().error("Unknown error during OpenAI inference: ", e)
    raise TryAgain from e

Improved code:
except (APIError, TryAgain) as error:
    get_logger().error("Error during OpenAI inference: ", error)
    raise
except RateLimitError as rate_limit_error:
    get_logger().error("Rate limit error during OpenAI inference: ", rate_limit_error)
    raise
except Exception as unknown_error:
    get_logger().error("Unknown error during OpenAI inference: ", unknown_error)
    raise TryAgain from unknown_error

Preparing suggestions...

PR Code Suggestions

Preparing suggestions...

PR Code Suggestions

Preparing suggestions...

PR Code Suggestions
💡 Suggestion
**[maintainability] It seems that the api_base attribute is used only in the chat_completion method. If it's not used elsewhere in the class or outside of it, consider moving it as a local variable in the chat_completion method to reduce the scope and improve encapsulation.
**
File: pr_agent/algo/ai_handler.py (29-60)
  Example code:

Existing code:
self.api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    api_base = get_settings().huggingface.api_base

💡 Suggestion
**[readability] Consider using f-string formatting for building the system and user strings. It's more readable and considered as a best practice in Python.
**
File: pr_agent/algo/ai_handler.py (112-115)
  Example code:

Existing code:
system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
         get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
       get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")

Improved code:
system = f"{get_settings().get('CONFIG.MODEL_SYSTEM_PREFIX', '')}{system}{get_settings().get('CONFIG.MODEL_SYSTEM_SUFFIX', '')}"
user = f"{get_settings().get('CONFIG.MODEL_USER_PREFIX', '')}{user}{get_settings().get('CONFIG.MODEL_USER_SUFFIX', '')}"

💡 Suggestion
**[readability] The get_max_tokens function could be simplified by using the dict.get() method with a default value. This way, you can avoid the conditional check.
**
File: pr_agent/algo/utils.py (378-380)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)
if settings.config.max_model_tokens:
    max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

Improved code:
max_tokens_model = min(settings.config.max_model_tokens, MAX_TOKENS.get(model, 4000))

💡 Suggestion
**[best practice] It's a good practice to pin the versions of your dependencies to avoid potential issues with future updates. Consider specifying exact versions for openai and litellm.
**
File: requirements.txt (5-25)
  Example code:

Existing code:
openai==1.3.5
litellm==1.7.1

Improved code:
openai==1.3.5
litellm==1.7.1

Preparing suggestions...

PR Code Suggestions
💡 Suggestion
It seems like the api_base attribute is only used in the chat_completion method. Instead of making it an instance attribute, consider making it a local variable in the chat_completion method to reduce the scope and improve encapsulation.
[maintainability]
File: pr_agent/algo/ai_handler.py (29-60)
  Example code:

Existing code:
self.api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    api_base = get_settings().huggingface.api_base

💡 Suggestion
The chat_completion method is becoming quite large and complex. Consider breaking it down into smaller helper methods to improve readability and maintainability.
[maintainability]
File: pr_agent/algo/ai_handler.py (81-147)
  Example code:

Existing code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    ...

Improved code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    # Break down the method into smaller helper methods
    ...

💡 Suggestion
The get_max_tokens function now has a default value for max_tokens_model if the model is not found in the MAX_TOKENS dictionary. This is a good practice to avoid potential KeyError. However, consider making the default value (4000) a constant at the top of the file or in a configuration file to make it easier to modify if needed.
[best practice]
File: pr_agent/algo/utils.py (378-378)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)

Improved code:
DEFAULT_MAX_TOKENS = 4000
max_tokens_model = MAX_TOKENS.get(model, DEFAULT_MAX_TOKENS)

💡 Suggestion
The versions of openai and litellm have been updated. It's a good practice to document the reason for updating these dependencies in the PR description, especially if the update includes major version changes that could include breaking changes.
[best practice]
File: requirements.txt (5-25)
  Example code:

Existing code:
openai==1.3.5
litellm==1.7.1

Improved code:
openai==1.3.5
litellm==1.7.1

Preparing suggestions...

PR Code Suggestions
💡 Suggestion [maintainability]
It seems that the api_base attribute is only used in the chat_completion method. If it's not used elsewhere, consider moving it to be a local variable within the chat_completion method to reduce the scope and improve encapsulation.
File: pr_agent/algo/ai_handler.py (29-60)
  Example code:

Existing code:
self.api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
api_base = None
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    api_base = get_settings().huggingface.api_base

💡 Suggestion [maintainability]
The chat_completion method is quite long and does a lot of things. Consider breaking it down into smaller helper methods to improve readability and maintainability.
File: pr_agent/algo/ai_handler.py (81-147)
  Example code:

Existing code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    ...

Improved code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    # Break down the method into smaller helper methods
    system, user = self._add_prefix_suffix(system, user)
    messages = self._create_messages(system, user)
    response = await self._get_response(model, messages, temperature)
    resp, finish_reason = self._process_response(response)
    return resp, finish_reason

💡 Suggestion [possible issue]
The get_max_tokens function could potentially return a mutable default value (4000) if the model is not found in the MAX_TOKENS dictionary. This could lead to unexpected behavior if the returned value is modified. Consider returning a copy of the default value instead.
File: pr_agent/algo/utils.py (378-378)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)

Improved code:
max_tokens_model = MAX_TOKENS.get(model, 4000)

💡 Suggestion [enhancement]
The requirements.txt file has been updated with new versions of openai and litellm. It's important to ensure that these new versions are compatible with the rest of the codebase and that they don't introduce any breaking changes.
File: requirements.txt (5-25)
  Example code:

Existing code:
openai==1.3.5
litellm==1.7.1

Improved code:
openai==1.3.5
litellm==1.7.1

Preparing suggestions...

PR Code Suggestions
💡 Suggestion type: [possible issue]
It seems like the chat_completion method has been modified to add prefixes and suffixes to system and user messages based on the configuration. However, the current implementation does not handle the case where these configuration values might be None. It would be better to add a default empty string to avoid potential TypeError when concatenating None with a string.
File: pr_agent/algo/ai_handler.py (112-115)
  Example code:

Existing code:
system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
         get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
       get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")

Improved code:
system = (get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX") or "") + system + \
         (get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX") or "")
user = (get_settings().get("CONFIG.MODEL_USER_PREFIX") or "") + user + \
       (get_settings().get("CONFIG.MODEL_USER_SUFFIX") or "")

💡 Suggestion type: [possible issue]
The chat_completion method has been updated to include api_base in the acompletion call. However, it seems like api_base is not always set in the __init__ method. It would be better to ensure that api_base is always set to avoid potential None values.
File: pr_agent/algo/ai_handler.py (58-60)
  Example code:

Existing code:
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
self.api_base = get_settings().get("HUGGINGFACE.API_BASE", "")
if 'huggingface' in get_settings().config.model and self.api_base:
    litellm.api_base = self.api_base

💡 Suggestion type: [possible issue]
The get_max_tokens function has been updated to handle the case where the model is not found in the MAX_TOKENS dictionary. However, the current implementation does not handle the case where MAX_TOKENS might be None. It would be better to add a default value to avoid potential TypeError when trying to get a value from None.
File: pr_agent/algo/utils.py (378-378)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)

Improved code:
max_tokens_model = (MAX_TOKENS or {}).get(model, 4000)

Preparing suggestions...

PR Code Suggestions
💡 Type: [maintainability]
It seems like the api_base attribute is only used in the chat_completion method. Instead of storing it as an instance attribute, consider fetching it directly from the settings within the chat_completion method. This would avoid unnecessary state in the AIHandler object.
File: pr_agent/algo/ai_handler.py (29-60)
  Example code:

Existing code:
self.api_base = None
...
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
...
api_base = get_settings().huggingface.api_base if 'huggingface' in get_settings().config.model else None
response = await acompletion(
    model=model,
    deployment_id=deployment_id,
    messages=messages,
    temperature=temperature,
    force_timeout=get_settings().config.ai_timeout,
    api_base=api_base,
)

💡 Type: [maintainability]
The chat_completion method has become quite large and complex. Consider breaking it down into smaller, more manageable functions. For example, the message formatting could be extracted into a separate method.
File: pr_agent/algo/ai_handler.py (112-116)
  Example code:

Existing code:
system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
         get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
       get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]

Improved code:
def format_messages(self, system: str, user: str):
    system = get_settings().get("CONFIG.MODEL_SYSTEM_PREFIX", "") + system + \
             get_settings().get("CONFIG.MODEL_SYSTEM_SUFFIX", "")
    user = get_settings().get("CONFIG.MODEL_USER_PREFIX", "") + user + \
           get_settings().get("CONFIG.MODEL_USER_SUFFIX", "")
    return [{"role": "system", "content": system}, {"role": "user", "content": user}]
...
messages = self.format_messages(system, user)

💡 Type: [enhancement]
The get_max_tokens function could be simplified by using the dict.get method with a default value, instead of using the if condition.
File: pr_agent/algo/utils.py (378-380)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)
if settings.config.max_model_tokens:
    max_tokens_model = min(settings.config.max_model_tokens, max_tokens_model)

Improved code:
max_tokens_model = min(settings.config.max_model_tokens or float('inf'), MAX_TOKENS.get(model, 4000))

Preparing suggestions...

PR Code Suggestions
💡 [enhancement]
It seems that the api_base attribute is only used in the chat_completion method. Instead of storing it as an instance variable, you could retrieve it directly from the settings within the chat_completion method. This would make the code more concise and easier to understand.
File: pr_agent/algo/ai_handler.py (29-60)
  Example code:

Existing code:
self.api_base = None
...
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base
    self.api_base = get_settings().huggingface.api_base

Improved code:
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
    litellm.api_base = get_settings().huggingface.api_base

💡 [maintainability]
The chat_completion method is quite long and does a lot of different things. Consider breaking it down into smaller helper methods to improve readability and maintainability.
File: pr_agent/algo/ai_handler.py (81-147)
  Example code:

Existing code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    ...

Improved code:
async def chat_completion(
    self, model: str, system: str, user: str, temperature: float = 0.2
):
    system, user = self._add_prefix_suffix(system, user)
    messages = self._create_messages(system, user)
    response = await self._get_completion_response(model, messages, temperature)
    self._log_response(response, messages, model)
    return response["choices"][0]["message"]["content"], response["choices"][0]["finish_reason"]

💡 [enhancement]
The get_max_tokens function could be improved by handling the case where the model is not found in the MAX_TOKENS dictionary more gracefully. Instead of defaulting to 4000, consider raising an exception or logging a warning.
File: pr_agent/algo/utils.py (378-378)
  Example code:

Existing code:
max_tokens_model = MAX_TOKENS.get(model, 4000)

Improved code:
if model not in MAX_TOKENS:
    get_logger().warning(f"Model {model} not found in MAX_TOKENS dictionary. Defaulting to 4000 tokens.")
max_tokens_model = MAX_TOKENS.get(model, 4000)

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

/improve

Preparing suggestions...

/analyze