Filter mlflow runs by commit ID - machine-learning

When using the UI of MlFlow, is it possible to filter/search the runs using the (git) commit ID? I manage to search by parameters but it doesn't seem like there's a way to filter by the commit ID.

In the latest version (1.21.0) you can filter by commit hash with this search string tags.mlflow.source.git.commit LIKE "truncated-commit-hash%". Probably this feature was introduced after you've originally posted that question.

The search in the ui is translated to a rest api call to the mlflow tracking server:
https://mlflow.org/docs/latest/rest-api.html#search-runs
You can see that you can search over 3 things: parameters, metrics and tags.
You can set the git commit id as a tag while training your model and then search for it, you can see how to set tags in the following link

Related

How to match any issue with jql in Bitbucket JIRA pre hook

I want to setup a simple pre hook in bitbucket that simply checks that there's a JIRA number in commit message. When I attempt to save it, I get a message that I should enter a valid JQL query to match the desired issues. How can I write this query to match ANY issue?
Can you please provide the JQL Query you are providing? If you want to get "All" Issues you can simply give a created > 0 or project = "Proj", either of which would catch all of your tickets. You could then use this to loop through your commit message and check your Jira Key (i.e. Proj-####) as a loop. I might also recommend on the Bitbucket you have a regex check whick looks for that specific pattern on your prehook, depending on how you write it.
Although, if you have configured it correctly it might actually be able to do it automatically. Check the documents here: https://support.atlassian.com/jira-software-cloud/docs/reference-issues-in-your-development-work/

Listing docker image in reverse chronological order using Artifactory API

I am trying to use the below API to get the list of docker images so that I could populate the dropdown on Jenkins build. Is there a way that this could be listed in a reverse chronological order rather than alphanumerical so that the newest image is at the top ? Thanks.
/artifactory/api/docker/repo/v2/image/tags/list
You will have to take help of Artifactory AQL query language.
An example AQL fragment is...
items.find({"repo":{"$eq":"<repositoryname>"}, "name":{"$eq" : "<artifactoryItemName>"}}) .sort({"$desc" : ["created"]})
The descending sort order is specified with $desc sort operator on the timestamp field created.
You can also limit the number of results returned by adding an extra limit to the above query...
items.find({"repo":{"$eq":"<repositoryname>"}, "name":{"$eq" : "<artifactoryItemName>"}}) .sort({"$desc" : ["created"]}).limit(10)
The AQL needs to be submitted at /artifactory/api/search/aql.
The same can be done via REST API as well with a POST request. The content should be posted not as a JSON but directly in the way query is specified as-is as text. The header for content type is Content-Type:text/plain. You can use the Basic authentication or other supported authentication methods.
There are a ton of things you can do with AQL. The syntax can look a bit confusing to begin with.

Use the public GitHub API to get all merged pull requests in a JSON format

I am trying to get all the closed and merged commits on a certain repository using the github API (https://api.github.com/), and the only way I have found to do this is to check for commits that are closed (api.github.com/repos/user/repo/pulls?state=closed), then make sure the merged_at is not equal to null, but this is a slow way to do it. Is there a way to make github check if the PR is closed and has been merged at the same time directly in the url? Something like api.github.com/repos/user/repo/pulls?state=closed?is_merged=true? And return all the PRs matching the criteria?
NOTE: this has nothing to do with the /repos/user/repo/pulls/pr_id/merge, because that only tells you if a single pull request is merged, and does not search everywhere in the list of PRs.
You can use the “is:merged” operator in your search query
Check this out: https://docs.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-based-on-the-state-of-an-issue-or-pull-request
Request template
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/search/issues\?q\=repo:{repo_owner}/{repo}+is:pr+is:merged
Explanation:
You can't get merged pull requests by std Github API /pulls route. But you can do this using Search API.
More info in docs:
Use Search API: https://docs.github.com/en/rest/search#about-the-search-api
More tricks for search issues and prs: https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests

How to enforce a format for a (pull request) merge commit message in BitBucket

Our team is migrating to BitBucket. Our workflow requires certain formatting for commit messages for code that is merged into the main origin repo.
Each developer has one (or more) fork(s). Our workflow is to push a feature/bug branch to the fork and create a pull request from that branch. Two other devs must review and +1 the pull request before it can be merged.
When someone clicks Merge, BitBucket displays a dialog with the title "Merge Pull Request". At that point, the dev can edit the text message that is logged for the merge before clicking the second Merge button. This is the message that needs to conform to a specific format.
I have read the documentation here: https://scriptrunner.adaptavist.com/latest/bitbucket/StashMergeChecks.html It has several very specific examples, but nothing that pertains to our use case. I have not been able to find a good, general-purpose reference for how to create merge checks.
I can write a condition that checks for a specific string value:
mergeRequest.message == "My Message"
But I need it to check against a regular expression.
How can I write a pre-merge hook to reject the merge if the message doesn't conform to a regex?
Addition
From the documentation, it seems like the condition check script code would be the right place to enforce this condition. The script can be added in Repository Settings > SCRIPTRUNNER > Script Merge Checks > Conditional merge check. There is a long list of examples shown for the conditional merge check, including things like:
Current user in a particular group
Changed files contains .XYZ files
Changed files in sensitive directory
Target branch is release
After some search & experiment I found I could block merges based on the commit message. But so far I have only found examples of comparing entire strings against constant string expressions. I haven't found how to use a regex in this comparison.
OP here after pushing this issue to the back burner for a few weeks. Issue is solved. You can check your merge commit messages against a regular expression without using a plugin. Solution is here for those who come searching with the same problem.
First, it was more challenging than it should have been to find the documentation for the objects that are most relevant to writing a Merge Check script. So here are a couple of links for the current 6.3.0 API:
PullRequest - In the end, my script didn't use this object, but the pull request is closely related to the merge request and others may need the documentation.
MergeRequest - This object has a method to determine the context (see below).
Second, the Merge Check script fires in two distinct contexts: (1) when bitbucket is trying to determine if it should enable/disable the Merge button on the Pull Request page, and (2) when someone clicks the Merge button on the Merge pull request dialog. In the first context the merge message is null, so it cannot match a regex. And anyway it doesn't make sense to disable the button in this case. I really only wanted the check to occur in the second context. So the script needs a way to distinguish the contexts.
Third, the message object is a Java String, so the script can call the matches() method to check if the message matches a regex.
After you have all the information at your fingertips, writing the script is pretty easy:
// the message regex
String pattern = "(PATTERN1|PATTERN2|etc)"
// reject if not dry-run and
// message doesn't match regex
! mergeRequest.isDryRun() &&
! mergeRequest.message.matches(pattern)
You could try some of the plugins for Bitbucket like YACC:
https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?hosting=server&tab=overview
If that doesn't meet your requirements, you could write your own:
https://developer.atlassian.com/server/bitbucket/how-tos/hooks-merge-checks-guide/

How to display Groups alphabetically on swagger-ui?

I'm using Swashbuckle.AspNetCore to create my swagger-ui.
I can order operations within a group the way I want, but how to order the groups themselves?
Ex: the correct order would be: ContratedDemand, Demand, Subscriptions and Users, but I'm getting as the image below.
I'm using Swashbuckle.AspNetCore 1.2.0
UPDATE: According to #HelderSepu (tks!), I have to set the Tags and the operations will be ordered according to them.
So, how to set the tags the way I want using Swashbuckle?
I finally found the problem.
The issue was due a conflict with the "LowerCaseDocumentFilter" (an IDocumentFilter) used to create all paths with lower case instead of the default .net PascalCase.
The code I was using was found here: https://github.com/domaindrivendev/Swashbuckle/issues/834
That class works fine for its purposes, but as it adds and removes the paths from the SwaggerDocument path dictionary, it changes the groups order as a side effect.
I removed this filter and the groups are now ordered alphabetically.

Resources