How to fix Wandb API giving error 400 when deleting artifacts? - wandb

I accidentally logged way too much to wandb and would like to delete some artifacts. I've tried the following script, but I get an error 400 whenever I run it:
import wandb
wandb.login(key=KEY)
api = wandb.Api(overrides={"project": PROJECT, "entity": ENTITY})
for run in api.runs():
files = sorted([f for f in run.logged_artifacts()], key=lambda f: f.updated_at)
print("Total files:", len(files))
print("Last file:", files[-1].name)
print("Last file date:", files[-1].updated_at)
for f in files[:-1]:
if ".tar" in f.name:
# also tried just f.delete()
a = api.artifact(f"{PROJECT}/{f.name}")
print("Deleting {}".format(f.name))
a.delete()
All I get is requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.wandb.ai/graphql

I work at Weights & Biases, I checked internally and it might be related to the artifacts having aliases, you might just need to try:
a.delete(delete_aliases=True)

Related

Issues with connecting Twilio Flex Digital Channels to Google Dialogflow CX

I have been following the blog post here and I've made it to testing the function on my local environment. I've copy and pasted everything form the blog into my text editor. Nothing in my code is original - but I cannot get it to work! When I try to run it in my local environment, I get this error:
const b = bindings[key].toString();
^
TypeError: Cannot read properties of undefined (reading 'toString')
at PathTemplate.render (/Users/dialogflow-cx/node_modules/google-gax/build/src/pathTemplate.js:114:37)
at SessionsClient.projectLocationAgentSessionPath (/Users/dialogflow-cx/node_modules/#google-cloud/dialogflow-cx/build/src/v3/sessions_client.js:1237:75)
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
at process.<anonymous> (/Users/dialogflow-cx/node_modules/#twilio/runtime-handler/dist/dev-runtime/internal/functionRunner.js:74:9)
at process.emit (node:events:390:28)
at emit (node:internal/child_process:917:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I don't know where to go from here! Help!
Here your TypeError is "cannot read properties of undefined", that means at least one of your passed arguments is undefined.
As we go through your return error, second line directs to the "projectLocationAgentSessionPath" and this section refers to the "Setup the detectIntentRequest" in the blog .
session: client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
The above error means at least on of the objects that relates to projectId, location, agentId, SessionId is returning undefined.
To resolve the error you have to check whether you are passing correct environment variables the same as .env files or not?
Within the error, we can see that there is a reference to the code you are working on:
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
This refers to this line:
client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
Following the code through the dialogflow library and then the Google API extensions library shows that ultimately the code is running through the keys of the object that relate to the project, location, agent and session which map to the 4 arguments above. And at least one of them is returning undefined.
Have you added the correct environment variables to your .env file? Are you passing a dialogflow_session_id when you make a request to test this endpoint?

How to get more information for an error generated in libcontainer/rootfs_linux.go?

Code used from github: https://github.com/opencontainers/runc/blob/master/libcontainer/rootfs_linux.go#L59
This is the if block to debug for our interest....
if err := mountToRootfs(m, config.Rootfs, config.MountLabel, hasCgroupns); err != nil {
return newSystemErrorWithCausef(err, "mounting %q to rootfs at %q", m.Source, m.Destination)
}
Here in the if condition, there is an error generated thru newSystemErrorWithCausef function and which internally uses generic_error.go, fmt.Sprintf to format the error string.
In our integration, only once it hit this if block. And in the process of getting more details, I wanted to troubleshoot and understand why this happened.
As of now tried using fmt.Printf(........) in line 55 and also just before if block of line 59.
And also tried putting above statement in very first line of prepareRootfs function. And then tried newSystemErrorWithCause(err, "some other message") in the first line of prepareRootfs function. Overall I dont see any information generated with my messages.
Please provide any information to understand more of this issue. Please note I am not looking for why this error might have been caused. I am looking for how to get more information from that function of prepareRootfs.

lua lfs on flashair w04 seems not to work

Hi for the last week i have been trying to get my Flashair to upload its files over ftp.
I can make a ftp connection without any problems, but when i try to iterate over the files in its folder its gives me a error on the lua lfs, the only thing its returning is nil.
its goes about this code sample:
for file in lfs.dir(localDir) do
attr = lfs.attributes(localDir .. file)
print( "Found "..attr.mode..": " .. file )
if attr.mode == "file" then
response = fa.ftp("put", ftpString..file, localDir .. file)
if response ~= nil then
print("Success!")
else
print("Fail!")
end
end
end
the error i get is:
lua: ftp.lua:17: attempt to index a nil value (global 'lfs')
stack traceback:
ftp.lua:17: in main chunk
[C]: in ?
where line 17 is the first line in the provided code sample.
Am I missing something, seems that i cannot find a lot information about this problem in combination with the Flashair.
Any help would be appreciated.
I am new to Lua so don't flame me if my response is not beneficial to you. I have been developing an app for W-03 and when testing the Lua app on my MACBOOK linux virtual env I was seeing the same error, and discovered I had to use require "lfs" statement in my test code. require "lfs" is not necessary when running on the actual W-03 though.

is it possible to catch 404 error without exit run in python?

I want to download a bunch of url list by:
urllib.request.urlretrieve(url, filename)
but sadly, few links are broken. and when urlretrieve meets that broken link
Traceback (most recent call last):
File "D:/Users/hyungsoo/PycharmProjects/untitled/check.py", line 71, in <module>
....blah_blah....
urllib.error.HTTPError: HTTP Error 404: Not Found
give me this error sign and program exited.
how to pass the broken url?
and moreover, is it possible to program tells me what link is broken?
You could try a "try...except..." statement, which you may find helpful. The "try" portion will attempt the given code, but the
"except" portion will be ready for the error message. It is really a wonderful feature. See teh following example:
while True:
... try:
... x = int(raw_input("Please enter a number: "))
... break
... except ValueError:
... print "Oops! That was no valid number. Try again..."
Note: Code taken from python APIs.

GCE Python API: oauth2client.util:execute() takes at most 1 positional argument (2 given)

I'm trying to get started with the Python API for Google Compute Engine using their "hello world" tutorial on https://developers.google.com/compute/docs/api/python_guide#setup
Whenever making the call response = request.execute(auth_http) though, I get the following error signaling that I can't authenticate:
WARNING:oauth2client.util:execute() takes at most 1 positional argument (2 given)
I'm clearly only passing one positional argument (auth_http), and I've looked into oauth2client/util.py, apiclient/http.py, and oauth2client/client.py for answers, but nothing seems amiss. I found another stack overflow post that encountered the same issue, but it seems that in the constructor of the OAuth2WebServerFlow class in oauth2client/client.py, 'access_type' is set to 'offline' already (though to be honest I don't completely understand what's going on here in terms of setting up oauth2.0 flows).
Any suggestions would be much appreciated, and thanks in advance!
Looking at the code, the #util.positional(1) annotation is throwing the warning. Avoid it using named parameters.
Instead of:
response = request.execute(auth_http)
Do:
response = request.execute(http=auth_http)
https://code.google.com/p/google-api-python-client/source/browse/apiclient/http.py#637
I think documentation is wrong. Please use the following:
auth_http = credentials.authorize(http)
# Build the service
gce_service = build('compute', API_VERSION, http=auth_http)
project_url = '%s%s' % (GCE_URL, PROJECT_ID)
# List instances
request = gce_service.instances().list(project=PROJECT_ID, filter=None, zone=DEFAULT_ZONE)
response = request.execute()
You can do one of three things here:
1 Ignore the warnings and do nothing.
2 Suppress the warnings and set the flag to ignore:
import oauth2client
import gflags
gflags.FLAGS['positional_parameters_enforcement'].value = 'IGNORE'
3 Figure out where the positional parameter is being provided and fix it:
import oauth2client
import gflags
gflags.FLAGS['positional_parameters_enforcement'].value = 'EXCEPTION'
# Implement a try and catch around your code:
try:
pass
except TypeError, e:
# Print the stack so you can fix the problem, see python exception traceback docs.
print str(e)

Resources