DOM may change during event processing

@foxdonut posted this code in gitter: http://codepen.io/anon/pen/EPdPbK?editors=1010
We have:

a <form> element with either either a class start or a class abort depending on the model state.
two event listeners: DOMSource.select(".start").events("submit") and DOMSource.select(".abort").events("submit")
the event streams are used to change the model state and by that changing the form's class

In beginning the form has the start class.
Now the problem is that when submitting that .start form, both event streams (select(".start").events("submit") and select(".abort").events("submit")) emit the event.
Why is this happening:
The event dispatching happens synchronous:

the dom event happens

the first listener catches the event, tests the .start selector which succeeds

the listener sends the event through the subscribed observable chain

this observable get's transformed into a new vtree which get's finally passed to the dom driver

the dom driver receives the new vtree and updates the dom

now the next listener catches the event (still the same event)

it tests the .abort selector. But the dom has already been updated by the dom driver so the form does now have the abort class set. So the test succeeds.

the listener sends the event down the seconds observable chain.

So solution might be to do some 2-phase dispatching: first test and collect all the observables that need to be notified for an event before the emitting any event item.
But even then one problem would remain: if for example some one in the observer chain want's to access the event's ownerTarget (eg map((evt) => evt.ownerTarget.dataset.userId)) the element could already have been updated by some preceding listener.
Another solution would be delay all DOM changes until the next frame.
Maybe there are other solutions.

Instead of doing all dom updates on the next frame maybe the dom driver could when receiving a new vtree item check if there is still event processing in progress and then delay the update until after the event processing (but still in the current frame)

I "fixed" the original pen by rendering all the views and showing/hiding elements according to the state. The issue described by @laszlokorte can be seen here: http://codepen.io/foxdonut/pen/LGJoXM?editors=1010

Interesting. Do you know why step (6) happens? So far it looks like a legit bug, but I have a feeling it's an XY problem.

I ran against the same problem in a slightly different way. Forked and changed the example above so it reflects the issue I ran into.
Instead of a form just i have two buttons that trigger the action. So a button with a .start class and a button with a .abort class and the intent listens to the click events in stead of the submit events.
If both buttons are shown on both views (initialView and startedView) it works as expected ( http://codepen.io/anon/pen/vLVdGz?editors=1010 ). But if the initialView only shows the start button and the startedView only shows the abort button it goes wrong. When you click on the start button the .start event is triggered, the startedView is rendered and directly the abort event is triggered ( http://codepen.io/anon/pen/adRqNy?editors=1010 ).
I don't know if this is significantly different than the original example but perhaps it helps. Tried myself to figure it out but I got lost in the simulateBubbling, fromevent, makeEventsSelector and makeElementSelector. I have the feeling it's somewhere around that area but I find it hard to track down.

@staltz simply because each events() call adds one listener. The delegation makes that both listeners are added to the root element.
The listeners (the raw dom listeners) are called in some order (I think in the order they are added).
Now if the first listener causes a synchronous dom change the second listener still will be called afterwards. Now the matchesSelector inside simulateBubbling will work with the already updated dom and will accept the event even though originally the event would not match the requirements that the form/button/whatever has the specified class.

If I'm not mistaken the following code from https://github.com/cyclejs/cycle-dom/blob/master/src/fromevent.js is where the raw eventhandlers are attached to the root element.
function createListener({element, eventName, handler, useCapture}) {
  if (element.addEventListener) {
    element.addEventListener(eventName, handler, useCapture)
    return disposableCreate(function removeEventListener() {
      element.removeEventListener(eventName, handler, useCapture)
    })
  }
  throw new Error(`No listener found`)
}

and the handler comes from the following code
function fromEvent(element, eventName, useCapture = false) {
  return new AnonymousObservable(function subscribe(observer) {
    return createEventListener({
      element,
      eventName,
      handler: function handler() {
        observer.onNext(arguments[0])
      },
      useCapture,
    })
  }).share()
}

If I set a breakpoint on observer.onNext(arguments[0]) I'm as close to the original event as I can get.
Now when you click start on the example ( http://codepen.io/anon/pen/adRqNy?editors=1010 ) you will pass this code two times (one for each eventhandler that is attached to the root element as expected).

The first time arguments[0] is a MouseEvent and arguments[0].srcElement = <button class="start">start</button>
Then the DOM is updated
Then the second event is processed. This time arguments[0] is a MouseEvent but arguments[0].srcElement = <button class="abort">abort</button>

So the second time the raw event gives the wrong srcElement/target/etc.
If you take the example I gave where both buttons are always shown ( http://codepen.io/anon/pen/vLVdGz?editors=1010 ) there are also two events being fired but both have the correct srcElement.
If I read the code correct this is all before the matchesSelector and simulateBubbling code and the error is somewhere in the fact that the DOM/browser can't create the event with the original srcElement if that element isn't there anymore.

Does the diff algorithm only replace the className in the button?! That could explain why you would get the wrong element. You would actually get the right element, but it is changed.......
........ I think I now understand what @laszlokorte said 22 hours ago :smile:

Yes of course the button is just updated with the new class name because
that's how virtual-dom works: calculate the difference between the old DOM
and the new DOM and apply as few changes as possible to get to the new dom
state.
So if the only difference is the classname the button is just updated.
If on the other hand you wrap the one button inside a div but not the other
then the two DOMs differ two much and when changing the state the old
button gets removed and a new button and the  div containing it will be
created and inserted.
In that case the event would still have the old button with the old
classname set as target and would be discarded by the listener and
everything would be fine
Am 07.02.2016 um 14:01 schrieb Arno den Uijl<EMAIL_ADDRESS>Does the diff algorithm only replace the className in the button?! That
could explain why you would get the wrong element. You would actually get
the right element, but it is changed.......
........ I think I now understand what @laszlokorte
https://github.com/laszlokorte said 22 hours ago [image: :smile:]
—
Reply to this email directly or view it on GitHub
https://github.com/cyclejs/cycle-dom/issues/99#issuecomment-181010671.

Interesting issue.  Another workaround is to add a different VNode key to each button to force virtual-dom to create a new node for each button. http://codepen.io/anon/pen/NxOeEo?editors=1010

Currently the event handlers are attached to the root node. The event handlers are for a given event type (click, input, etc.). The filtering for the element the event happened on is done in the simulate bubbling. So when we have two event handlers DOM.select('.start').event('click') and DOM.select('.abort').event('click') there are two raw event handlers attached to the root element for click events. And two streams with their own bubbling behaviour to distinguish the start and abort actions.
The problem now is that on one click event multiple raw handlers trigger and because one of the handlers modifies the DOM the second reads from a tainted DOM to construct the MouseEvent object.
The biggest/only problem is that the mouseevent object in the second handler does not reflect the real event that happened. If it was immutable and both raw handlers would always get the same original event arguments there probably would be no problem. Even if the DOM is updated one or more times in between that wouldn't impact the processing of the second handler because it would still work with the original data and the DOM is only output.
In the current setup with multiple raw handlers for the same event type this can't work because we have no influence on how the event data is constructed.
But we could make it so that we have one raw handler for every needed event type (so in this case one click handler on the root node. When the event triggers we make an immutable copy of the event arguments and then fan out over all the subscribers. This way we can force immutable and correct event arguments for all subscribers.
I think that would take care of the issue. Agreed? Or am I missing something?

@arnodenuijl I agree that having only one listener attached for each event type is a good idea.
But copying the event is not possible in that case because it would need to be a deep clone. Not only the event object itself would need to be copied but the target element (and maybe event the parent of the target... ie the whole DOM hierarchy). That is not possible for two reasons: first you do not want to clone that many objects from a performance point of view. Second the listener may want to access the original target element instead of some dead cloned element.
Eg in my application I have a autoResizeDriver that takes a stream of elements (textareas) and adjusts their size to get rid of scrollbars.
I use it like this:
return {
  DOM: ...,
  autoresize: DOM.select('.mytextarea').events('input').map((evt) => evt.ownerTarget)
}

If ownerTarget or target would just be copies of the original textarea element the driver would resize some element that is not even attached to the DOM.

So a I wrote earlier I would suggest something like:

add only one dom listener for each event type (click, submit, mousemove....)
manage a custom list of observables for each event type
the dom listener iterates over the corresponding list and notifies each matching obersable
before the iteration it sets some global eventIsProcessed flag to true
If a new vtree$ item is emitted during eventIsProcessed is true, it get buffered, the DOM is not updated
If a new vtree$ item is emitted during eventIsProcessed is false, the DOM get's updated immediately as usual
after the listener's loop completes eventIsProcessed is set back to false
after the listeners loop completes the listener checks if there is some buffered vtree$ item. If yes it updates the DOM

All this happens in one frame without any timeout or animation frame so there is no loss in performance.

Size is a thing indeed. I liked the idea of immutability and side effect free with the cloning. But I hadn't thought of using this from a driver where the side effects are just what you want.
I get some chills from a global eventIsProcessed flag. Usually these kind of things turn out into some race condition deathtrap. And performance wise it feels like you will be surrendered to whatever is subscribed to the observables  But don't have an alternative so....

Ok I did not mean global but a flag inside the DOM driver which can be accessed by both the listener function and the function subscribed to the vtree$ stream.
Of course the final performance depends on the performance of the observable stream. But that's the case currently as well.

Global for the driver indeed. But thats pretty global.
Regarding the performance: now you can have an update of the DOM after the first handler is processed. And after that the other handlers are processed that may or may not result in another update for the DOM. But in the new setup you have to wait for all, even if they don't do anything to the DOM.

Global: I do not see the problem. it's only used by the driver and there are only a very limited ways the flag is accessed. It's not some complex magic.
Currently you have no control over which of the listeners will be called first so you can end up with one slow listener being called before the DOM updating listener being called.

Couldn't you get multiple concurrent  events each notifying their own observers?  Then you have to manage the flag across multiple calls. Or can't this happen in JavaScript?

javascript is single threaded so you can not have multiple observables running concurrently.

I think with schedulers you could make an rx stream do some long running stuff while giving the system room to let another event being called. So  it would be possible to have one stream running while another event is being handled and kicking off another stream. Probably not common. But I'm not convinced it can't happen. (and if something can go wrong......). From the observable side when you call onNext you never know when the full chain is done processing so you won't know until when you will have to buffer or throttle the updated DOM.

You do not have to wait until all chains are completely processed. You only have to wait until all listeners have been notified.
If somewhere in the chain a scheduler is used to do some async processing you do not have to care anymore because then onNext returns immediately and the next listener/observable can be notified.
When using some async scheduling you would have to take care of cloning all the dom data you need anyway. Currently you have the same problem that some async scheduled event may be mutated/outdated at the time it reaches some point in the chain. You have to take care of cloning the properties you want to use manually.
As I said ultimately that can not be solved because the underlying DOM API is procedural by nature and you can not handle DOM elements/events as if they were values types.

Many thanks @laszlokorte and @arnodenuijl for doing some thought work on this. I know many days have passed without my reaction, but I've been following. I've been super busy in February, but soon I'll make more time for Cycle.js and fix this (and other issues). PRs are welcomed, as always, if you feel like speeding it up.

And, I agree with the plan Laszlo sketched, we will probably go with that as plan A.


IntelliJ IDEA Plugin: autoCorrect when possible

Expected Behavior
Option in Alt+Enter to run the offending Rule again with autoCorrect=true on the active file.
Current Behavior
No actions on violations.

Context
autoCorrect is a really nice feature, but quite hard to use if we need to run command line utilities (e.g. gradlew :detekt with autoCorrect=true in build.gradle). The Detekt plugin is already showing the warning nicely where the Finding is. It would be quite useful to elevate Detekt to a level of IDEA inspections and have quick fixes.

Nice one @arturbosch, surprised how simple it is. A quick comment: "Format" assumes that the user is using the ktlint wrapper in Detekt, but autoCorrect is a general feature. "Auto-correct with Detekt" might be a more generic label.


O>Implement w3c verifiable claims api on RChain and their usecases worked out.

@Viraculous Feedback from Bas Kapijn ( Architect of ICTU/Discipl ); Hello Victor, note we are a very small team. There hasnt formed yet a real community around discipl. We (some of our team) might think of using rchain in some future project and as such might collaborate with the rchain community but i cant say for sure nor when. We are not really talking about it and are busy with a lot of other things to be honest. I'd be helped more when apart from such a project the rchain community would try and help build a discipl core binding to rchain instead of the other way around (us building it ourselves in the rchain community of which i don't think will happen given our ample time/resources). In a sense this would mean collaboration too as i'd have to explain rchain devs more about what discipl actually is and make discipl core more mature. Note that discipl core is mostly a w3c verifiable claims api on top of which a new needs centered discipl pattern api will be build. Implementing the binding to rchain would mean rchain could be a choice of platform (one of the supported platforms) for use cases (8 of them currently in development) build upon discipl core. If rchain dev people are interested in this, they can contact me (note also: then it would be best when these people are living in nl so we could meet once or twice). I hope this helps?. Regards  Bas Kapijn.  #247

https://www.w3.org/2017/vc/WG/
https://www.w3.org/TR/verifiable-claims-data-model/

[ ] Implement w3c verifiable claims api on RChain

[ ] Get their 8 use cases.

Measure of Completion:  Implemented w3c verifiable claims on api on RChain and working use cases.
Suggested Budget:$3000
Time: Before end of March

@Viraculous, I sent a mail to w3c but they are yet to reply, I have been doing a lot of studies concerning this and would give the group a reply later today or tomorrow, do you have any progress report yet?

@Viraculous I think it will be more than two weeks until the rholang compiler and such support even the most basic contracts. And even then, two weeks to implementing the API and work out the use cases doesn't seem realistic. Are you offering to get the job done in two weeks? Or estimating that someone else could do it in two weeks?

@David405 , thank you for your for efforts. I would like to get your reply from the w3c. I will keep in touch with Bas kapijn and w3c with as much as possible. @dckc as for the time, its not objective, its an estimate. It can be adjusted to a more flexible time space. How about before the end of march? It must be noted however that this issue is a crop out of the mother issue #247 . Drawing from Bas Kapijn's reply, our developers can reach out in collaboration with Bas Kapijn.

"our developers"? Who does that refer to?

@dckc did you fully read the quote? Its an inference from Bas Kapijn it.

I'm still struggling to understand.
So Kapijn and his development team can reach out... to whom?
And @David405 where did you send your email? I don't see anything relevant in the wg archives

@dckc, if you study the documents carefully you should find relevant information. there is a mailing list at the right side of the page. For more information on verifiable claim use cases check out https://www.w3.org/TR/verifiable-claims-use-cases/

I have studied the documents.
What is the url of the archived copy of your mail message?

Here is the url https://lists.w3.org/Archives/Public/public-publ-wg/2018Feb/0159.html

So you sent it to<EMAIL_ADDRESS>that's a mailing list for the publishing working group.
The verifiable claims document says:

Comments regarding this document are welcome. Please send them to<EMAIL_ADDRESS>
In any case, I don't know why you would expect the verifiable claims working group to provide "an urgent robust documentation or tutorial ... on how to get Discipl Api and verifiable working claim". Your message is not a comment on the spec. It's a request for an entirely separate work product; one that is not in their scope.
If you demonstrate that you have put significant effort into integrating Discipl with verifiable claims and you are having some difficulty with a specific part of the VC spec, you could expect them to explain that part of the spec.

@dckc, I understand your point, if you have made any effort integrating Discipl with verifiable claims I would love to see what you have done, it would act as a guide of some sort.

I have not done any work with Discipl.
I try to see that at least the Development issues are on track. I still don't see a realistic objective here. As indicated by the needs-SMART-objective label, I'm inclined to close this unless I see progress or a refined plan from one of the assignees within a few days.

@dckc, am not skilled in development issues and as such have little knowledge of how SMART this issue could be. You suggested reducing the scope of the issue, would that help making it more actual?  I guess u have a better idea using w3c claims, please let's see how to get the issue SMART and actionable. Permit me to assign you.

@dckc I think the issue is worth looking into,  if closely looked into,I think it's realistic objective would be seen, since @Viraculous isn't skilled in developments issues, I suggest @David405, @hyperevo and likewise yourself could look closely into it, the issue of #247 has gone soo far to just be abandoned on the stand of no clear objective,you could actually help to see that this development issue goes on track, we want to see that we don't lose a vital connection as that of discipl, at least not after making high paces, communication and interest.we won't be wrong believing in your development expertise on this,  don't you see it in closely same perspective?

@msporny my energies are currently directed elsewhere, so if it were up to me, I was going to close this as wontfix. But maybe it's something we should talk about... let me know if you want me to fill you in on RChain and talk about how a verifyable claims implementation could fit in.
It might be fun to take a crack at it in monte (see #427).

looks like both @msporny and I have too much on our plates to move this forward.
Anybody who does significant work on it, go ahead and reopen it.


MoveDirectory and CopyDirectory with overwrite

Please support overwriting with MoveDirectory and CopyDirectory.
A bool parameter in the third position would make sense, wouldn't it? This seems common enough and similar enough to other APIs:
MoveDirectory(fromPath, toPath, true);
CopyDirectory(fromPath, toPath, false);

Or should an entire options class be created in order to specify Overwrite?

@gsferreira I have tried that angle, but the need is intrinsic. I'm ILMerging into an assembly of the same name, so I need to specify a temporary folder for the output so the output doesn't overwrite the input .dll, .pdb and .xml. This causes ILMerge to crash. However as soon as ILMerge is finished, I need to copy whatever files are in the temporary directory into the original folder. The overwritten files may be any combination of .dll, .pdb, .xml, etc and I should not have to code specifically for any one of them: if present, they should simply replace the files in the original directory.


Adds Falco.Markup support and NuGet package

Hi there!
I recently decoupled the markup module within Falco into it's own NuGet package. And I'd love to extend your fleet of libs to include it!
I feel like I have touched all the places that need addressing to make this happen. A couple points:

I used an initial version of 2.0.0 to keep in line with the others.
I was confused by this in the docs: "...there is no automatic injection of styles into the dom". I included it in the Falco docs anyway, but I just wasn't sure what you meant by it.
I set the package version to track a rolling patch version 1.0.*.

Thanks for your work on this!

My pleasure! So glad you like Falco, It is my pride and joy 😊
That answer clarifies things, thank you! Let'r rip!


Update isbm.txt

this update to include English name for the institute

@Sfax2024 First stage of verification passed, official domain for Institut superieur de biotechnologie Monastir is isbm.rnu.tn as far as I verified. This is just an informational note. Pull request is still in the review. I appreciate your patience while waiting for the final decision.

@Sfax2024 Thank you for your patience while waiting for a review and processing your request. Pull request merged.


Alphabetizing logic

At next meetup remember to include need for alphabetizing logic in intro to project.

Found this--is this relevant/useful to our project? http://stackoverflow.com/questions/7934547/python-find-closest-key-in-a-dictionary-from-the-given-input-key

https://docs.python.org/3.0/library/bisect.html#examples


[Hosting] Hosting output conflicts with logging output.

Create a template.
Set console logging to debug
Run the app a few times.
At some point, the Hosting log messages will be incorrectly interleaved with the logging output.

dbugHosting environment: Development
Content root path: C:\work\validation\angularpublishdbg30
: Microsoft.AspNetCore.Hosting.Diagnostics[4]
      Hosting started
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[0]
      Loaded hosting startup assembly angularpublishdbg30

We discovered this as we were capturing the console output and looking for Now listening on:  messages in the templates tests, and they were hanging when we couldn't find the message.

Is this 3.0? This happens if you use WebHost because the "Now listening on" is written with Console.WriteLine and interleaves with logging. If you use Generic Host it uses logging and shouldn't interleave.

@anurse This happens with our templates.
Awesome. That's good to know. Seems like the SPA templates didn't get updated to use generic host


SourceContext not being injected into BackgroundService (net core 3.1 app autofac5)

Firstly, I don't believe I've correctly identified the problem but will describe as best to my understanding.
In a net core core 3.1 app, we have background services that trigger at startup.  What was being observed was sourcecontext  was set on any log messages, yet it does appear fine on the main web process.
Pulled the code locally and updated to autofac 5, the signature for AttachToComponentRegistration was different so updated.  Created sample scenario site, and observed that the SourceContext prop is now being correctly applied to the backgroundService.

Closed in #28


Allow administrator to disable a runner

This pull request introduces a new API and corresponding CLI commands which allows administrator to disable (and re-enable) a particular runner.
In addition to that, it includes other related changes and improvements:

It ports RunnerType API endpoint to utilize ResourceController class. This way this API endpoint behaves the same as other API endpoints (limit works, filtering works, etc.) and means we can get rid of the duplicated code.
Introduces RBAC support for RunnerType resource. This is need because only admins (or people with an explicit permission grant) are allowed to disable / enable a runner (previously we could get away with not having RunnerType API endpoint behind RBAC wall, not we can't anymore).
Fixes runner registration - if user has explicitly disabled a runner through the API, runner won't get re-enabled when running register content and registering runners (aka the expected behavior).
Introduces functionality which allows administrator to disable a runner (aka hooks up runner enabled attribute)

Background
I initially went with the config approach, but in https://github.com/StackStorm/st2/pull/2671#discussion_r62194745, @manasdk pointed out that we already have a concept for disabling a particular runner (aka enabled attribute on the RunnerTypeDB model). This attribute was there, but it wasn't hooked up and working so I hooked it up.
The whole change did require more work compared to the config approach (rbac, etc.), but imo it's worth it (RBAC is something we would eventually need to get done anyway) and this approach is generic so it applies to every runner, not just local one.
TODO:

[x] Update BaseRunner pre_run method to throw and abort action execution if a runner is disabled. Also update all the affected runner classes (aka all classes which inherit from the base class).
[x] Only allow "enabled" attribute of the runner to be changed through the modify / PUT API endpoint
[x] Tests for RBAC permissions resolver
[x] Tests for a disabled runner

I also added some new RBAC related assertion methods which return a more user-friendly exception if assert fails.
Previously, we only had assertion methods which returned true / false which means an exception which was thrown on a failed assertion wasn't really helpful (it included no context) so it made it harder to track down the tests failures and bugs in the code.
I will update affected tests in this PR.

This was way more painful then it should have been - 0ea6d04e64e6f0aa435eaa6a2cbdb55b8893842b

Added some more tests, fixed some more bugs.
Merging into master once the Travis checks pass.


Excessive new connections to Postgres

Expected Behavior
Under load the number of connections to the Postgres database backend remains fairly consistent over time.
Actual Behavior
When under load it has been observed that there are many new connections being made to the Postgres database being used as the DB backing for the history service.  (200+ new connections per second during load test). The expectation is that the number of connections may rise to handle the load but it should achieve a steady state and relatively few connections killed and re-established.
One suggestion is that the method get may be being called frequently and for some reason the refcount is not incremented so remains at 0 and many new connections returned.  To look into the problem further to see if this theory is valid.
https://github.com/temporalio/temporal/blob/b383ffffcbbeacdfce2fe021c30f093bab64b5d9/common/persistence/sql/factory.go#L195
Steps to Reproduce the Problem

Install self-hosted platform using Postgres as the DB
Setup montoring for the number of connections/new connections being made to DB
Run load test

Specifications

Version: 1.24
Platform: Kubernetes via Helm charts

Develop for durability - Temporal Python SDK Background Check tutorial | Learn Temporal
Skip to main content
Replay will return September 18-20 in Seattle! Secure your ticket.
Home Get started Courses Project-based tutorials Example applications Documentation
Search

Home

Get started with Temporal

Courses

Project-based Tutorials

Go tutorials

Java tutorials

TypeScript tutorials

Python tutorials

Build a data pipeline with Python

Build an email drip campaign with Python

Build a trip booking application in Python

Build a Background Check application with Temporal and Python

Introduction
Project setup
Develop for durability

PHP tutorials

Infrastructure tutorials

Example applications

Zines

Dev guide

Documentation

Forums

Home page

Project-based Tutorials

Python tutorials

Build a Background Check application with Temporal and Python

Develop for durability

On this page
Develop for durability - Python SDK dev guide
Last updated on Aug 21, 2024
Tags:

activity
cloud-certificate
code-sample
dev-guide
docker
go-sdk
introduction
project-setup
python-sdk
self-hosted
temporal-cli
temporal-client
temporal-cloud
test-framework
testing
worker
workflow

This section explores how to build a Workflow for Durable Execution using the Temporal Python SDK.
The Background Check Workflow
Our Background Check Workflow will take a social security number, ssn and an identifier, unique_id, as input.
The Workflow will be responsible for coordinating a background check, which is implemented as an Activity.
Create a new file called background_check_workflow.py.
workflows/backgroundcheck_dacx.py
from datetime import timedelta
from typing import Any, List

from temporalio import workflow

with workflow.unsafe.imports_passed_through():
    from activities.ssntraceactivity_dacx import ssn_trace_activity

@workflow.defn
class BackgroundCheck:
    @workflow.run
    async def run(self, ssn: str, unique_id: str) -> str:
        # Execute the Activity "ssn_trace_activity"
        # retry for a maximum of 3 times
        # wait for the activity to complete.
        return await workflow.execute_activity(
            ssn_trace_activity,
            ssn,
            unique_id,
            schedule_to_close_timeout=timedelta(seconds=10),
            retry_policy=workflow.RetryPolicy(
                maximum_attempts=3,
                maximum_interval=timedelta(seconds=10)
            )
        )

Define the Activity
The Background Check Activity verifies the validity of the social security number passed as an argument to it.
The Activity can be implemented as a function, and can be asynchronous or synchronous.
Create a new file called ssn_trace_activity.py in the activities directory.
activities/ssntraceactivity_dacx.py
from temporalio import activity

@activity.defn
async def ssn_trace_activity(ssn: str, unique_id: str) -> str:
    # ... Implement logic to trace SSN.
    if ssn == "555-55-5555":
        return "pass"
    else:
        return "fail"

Set up a Worker
To run a Worker Process with a local development server, define the following steps in code:

Initialize a Temporal Client.
Create a new Worker by passing the Client to creation call.
Register the application's Workflow and Activity functions.
Call run on the Worker.

In regards to organization, we recommend keeping Worker code separate from Workflow and Activity code.
Create a new file called main.py in the worker directory.
worker/main.py
import asyncio
import os

from temporalio.client import Client, TLSConfig
from temporalio.worker import Worker

from activities.ssntraceactivity_dacx import ssn_trace_activity
from workflows.backgroundcheck_dacx import BackgroundCheck

async def main():
    client = await Client.connect(
        os.getenv("TEMPORAL_HOST_URL"),
        namespace=os.getenv("TEMPORAL_NAMESPACE"),
        tls=TLSConfig(
            client_cert=open(os.getenv("TEMPORAL_MTLS_TLS_CERT"), "rb").read(),
            client_private_key=open(os.getenv("TEMPORAL_MTLS_TLS_KEY"), "rb").read(),
        ),
    )

    worker = Worker(
        client,
        task_queue="backgroundcheck-boilerplate-task-queue",
        workflows=[BackgroundCheck],
        activities=[ssn_trace_activity],
    )
    await worker.run()

if __name__ == "__main__":
    asyncio.run(main())

Run the Workflow using the Temporal CLI
You can use the Temporal CLI to start a Workflow whether you are using a local development server, Temporal Cloud, or are in a self-hosted environment.
However, you need to provide additional options to the command when operating with the Temporal Cloud or self-hosted environments.
Temporal Cloud
How to start a Workflow with Temporal CLI when using Temporal Cloud
Run the temporal workflow start command, and make sure to specify the certificate and private key arguments.
temporal workflow start \
 --task-queue backgroundcheck-boilerplate-task-queue-cloud \
 --type BackgroundCheck \
 --tls-cert-path ca.pem \
 --tls-key-path ca.key \
 --input '"555-55-5555", "a-unique-id"' \
 --namespace <namespace>.<account-id> \
 --address <namespace>.<account-id>.tmprl.cloud:<port>

Make sure that the certificate path, private key path, Namespace, and address argument values match your project.
Use environment variables
Use environment variables as a way to quickly switch between a local dev server and Temporal Cloud, for example.
You can customize the environment names to be anything you want.
# set Cloud env variables
temporal env set cloud.namespace <namespace>.<account-id>
temporal env set cloud.address <namespace>.<account-id>.tmprl.cloud:<port>
temporal env set cloud.tls-cert-path ca.pem
temporal env set cloud.tls-key-path ca.key
# set local env variables
temporal env set local.namespace <namespace>

In this way, you can just provide a single --env command option when using the Temporal CLI rather than specifying each connection option in every command.
temporal workflow start \
 # ...
 --env cloud \
 # ...

List Workflows
Run the temporal workflow list command, and make sure to specify the certificate and private key arguments.
temporal workflow list \
 --tls-cert-path ca.pem \
 --tls-key-path ca.key \
 --namespace <namespace>.<account-id> \
 --address <namespace>.<account-id>.tmprl.cloud:<port>

View in Web UI
Visit the Workflows page of your Cloud Namespace.
The URL will look something like the following:
https://cloud.temporal.io/namespaces/<namespace>.<account-id>/workflows

Self-hosted
How to start a Workflow with the Temporal CLI when using a Self-hosted Cluster
Use your Temporal CLI alias to run the temporal workflow start command and start your Workflow.
temporal_docker workflow start \
 --task-queue backgroundcheck-boilerplate-task-queue-self-hosted \
 --type BackgroundCheck \
 --input '"555-55-5555", "a-unique-id"' \
 --namespace backgroundcheck_namespace

List Workflows
Using your Temporal CLI alias, run the temporal workflow list command.
This command lists the Workflows Executions within the Namespace:
temporal_docker workflow list \
 --namespace backgroundcheck_namespace

View in the Web UI
When you visit for the first time, the Web UI directs you to http://localhost:8233/namespaces/default/workflows.
Use the Namespace dropdown to select the project Namespace you created earlier.
You should now be at http://localhost:8080/namespaces/backgroundcheck_namespace/workflows.
Run a Worker
To start your Worker process:

Create a Dockerfile:
FROM python:3.11

RUN mkdir /app

COPY . /app

WORKDIR /app

RUN pip3 install poetry

RUN poetry config virtualenvs.create false

RUN poetry install

CMD [ "poetry", "run", "python", "/app/worker/main.py" ]

Build the image:
docker build . -t backgroundcheck-worker-image:latest

Run the Worker:
docker run --network temporal-network backgroundcheck-worker-image:latest

Add a testing framework
Each Temporal SDK has a testing suite that can be used in conjunction with a typical language specific testing framework.
In the Temporal Python SDK, the testing package ( https://python.temporal.io/temporalio.testing.html) provides a test environment in which the Workflow and Activity code may be run for test purposes.
The BackgroundCheck Workflow code checks the following conditions:

It receives a social security number and a unique ID as input parameters.
It starts a new Activity ssn_trace_activity with the input SSN.
It waits for the Activity to complete and returns the result.
If the Activity returns "pass", it logs a message indicating that the background check passed.
If the Activity returns "fail", it raises an exception indicating that the background check failed.

We can also perform a Workflow Replay test, and we'll provide detailed coverage of this topic in another section.
Add Workflow function tests
This is a unit test written in Python using the pytest library.
The test checks the execute_workflow method of the BackgroundCheck Workflow.
The test creates a new WorkflowEnvironment and a Worker with a Task Queue and the BackgroundCheck Workflow and ssn_trace_activity activity.
Then, it executes the BackgroundCheck.run method with a social security number and a unique ID, and asserts that the result is equal to "pass".
The test is marked with @pytest.mark.asyncio to indicate that it is an asynchronous test.
docs/tutorials/python/background-check/code/backgroundcheck_dacx/tests/workflow_test.py
import uuid

import pytest

from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker

from activities.ssntraceactivity_dacx import ssn_trace_activity
from workflows.backgroundcheck_dacx import BackgroundCheck

@pytest.mark.asyncio
async def test_execute_workflow():
    task_queue_name = str(uuid.uuid4())
    async with await WorkflowEnvironment.start_time_skipping() as env:
        async with Worker(
            env.client,
            task_queue=task_queue_name,
            workflows=[BackgroundCheck],
            activities=[ssn_trace_activity],
        ):
            assert "pass" == await env.client.execute_workflow(
                BackgroundCheck.run,
                "555-55-5555",
                "a-unique-id",
                id=str(uuid.uuid4()),
                task_queue=task_queue_name,
            )

Add Activity function tests
This is a Python using the pytest framework and the ActivityEnvironment class from the Temporal Python SDK.
It tests the ssn_trace_activity function from the activities module.
The function takes a social security number as input and returns a string indicating whether the SSN is valid or not.
The test checks if the function returns "pass" when given the SSN "55-55-555".
docs/tutorials/python/background-check/code/backgroundcheck_dacx/tests/activity_test.py
import pytest
from temporalio.testing import ActivityEnvironment
from activities.ssntraceactivity_dacx import ssn_trace_activity

@pytest.mark.asyncio
async def test_ssn_trace_activity() -> str:
    activity_environment = ActivityEnvironment()
    expected_output = "pass"
    assert expected_output == await activity_environment.run(
        ssn_trace_activity, "555-55-5555", "a-unique-id"
    )

Conclusion
You have now built a Workflow for Durable Execution and registered your Workflow and Activity with a Worker that will run with a Temporal Cloud environment.
You also added some basic Python tests using the pytest framework and Temporal's testing package.
Your Worker can now execute the Workflow on a schedule.
The Temporal Python SDK offers various features to build durable and resilient workflows.
In the next section of this tutorial, you'll review the code to understand what happens when a Background Check fails.
Tags:

activity
cloud-certificate
code-sample
dev-guide
docker
go-sdk
introduction
project-setup
python-sdk
self-hosted
temporal-cli
temporal-client
temporal-cloud
test-framework
testing
worker
workflow

Last updated on Aug 21, 2024
Previous

Project setup Next

Build a Background Check application with Temporal and Python

Install the Temporal CLI

Install via download
Install via Homebrew
Build

Choose a development Cluster

Local dev server

Start the dev server
Create a custom Namespace

Temporal Cloud
Self-hosted Temporal Cluster

Boilerplate Temporal Application project code

Project structure
Initialize Python project dependency framework
Boilerplate Workflow code
Boilerplate Activity code
Run a dev server Worker
Run a Temporal Cloud Worker
Run a Self-hosted Worker

Confirm network
Confirm IP address
Customize Client options
Build and deploy Docker image

Start Workflow using the Temporal CLI

Local dev Server

List Workflows
View in Web UI

Temporal Cloud

List Workflows
View in Web UI

Self-hosted

List Workflows
View in the Web UI

Add a testing framework

Add Workflow function tests
Add Activity function tests

The Background Check Workflow

Define the Activity

Set up a Worker

Run the Workflow using the Temporal CLI

Temporal Cloud

List Workflows
View in Web UI

Self-hosted

List Workflows
View in the Web UI

Run a Worker

Add a testing framework

Add Workflow function tests
Add Activity function tests

Github

Twitter

YouTube

Join our Slack group

Temporal Cloud

Meetups

Workshops

Support Forum

Ask an expert

Documentation

Use Cases

Blog

Newsletter Signup

Security

Privacy Policy

Terms of Service

We're Hiring

Copyright © 2024 Temporal Technologies Inc.


Using assets from external modules

Currently all assets have to be in the static directory of the application in order to be included in the build. If we have an external component library that has its own images/fonts etc... how can we include them? As a workaround we have a post install script that copies assets from the external library into the application static directory, although this doesn't feel like the correct solution.
I understand Lightning uses Rollup, would it be possible to use https://github.com/rollup/plugins/tree/master/packages/image to do something like this?
import icon from './icon.png'

export default class App extends lng.Component {
  static _template() {
    return {
      Icon: {
        src: icon,
      },
    }
  }
}

Hi @lewispeel,
are you using a bootstrapper on top of Lightning app e.g. SDK or is it just raw Lightning?
Best regards

We're using the SDK as it comes by default when using lng create from the CLI tools for our apps. So when requesting images we're doing this;
import { Lightning, Utils } from 'wpe-lightning-sdk';

export default class Background extends Lightning.Component {
  static _template() {
    return {
      Background: {
        w: 1920,
        h: 1080,
        src: Utils.asset('images/bg.png'),
      },
    };
  }
}

Although we have a component library which is external to the main app that uses raw Lightning.

The images from the component library are being exported as Base64 encoded images, so I guess the question is, can Lightning handle an image src like...
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAClUlEQVRYhe2YW47VMAyGf6c9zAtCggXAJuYFJNDsARYAi2UDbIB5RPA2EkIwnRhlektdO02alicsVc3Jxfn620l6iv9WaXS2gMxcNUc1YC3AlrkznR9hu56+QLVqdYsdJOBK67OsrRmcYVSrYtbgAtW2fhfNm9UxA86CIqWuGHBPiDXnGkAK0KpbWW0O5qq3W0GzoxJaTRFSypaaJZChjWEpuLHPWaFLqSYPhJwDgkzADShZ5zJUs/psWg6gpoyVa24j5Kk61fYoqAGQCJvbaEv5XVjJKs5Jfk1hWXaGP9UWgGJxpDZoTR0nlJNlDVLOtZpzbw5qjmUYLVjZ9/AclPUxgAYFBdBKj92AEA4tKAu4MRTchCxR0FoM8aRxaNsIjiNIZ+TgLgVLjy4n2sa7VDD20wzj2uHeRPdmAixcwaPJxRDXNyLUcd8nAF4DuAb4JUDPAFzND8LTuJSCluypE8NFcHHfSEH/DqD3gH8+RHoEcvM9XNSEptIczDlRrH3QAd1HADcI0SJi4AFDfnr0Jf8ISUT9M3VJBXPBLchlWP39JzjcTCN7yDvA3QL4DrhfIHRLEdqqN2pLOQXw91s4ipTzDLp8AZqv43vfiD2pmXofNIA0uNSYof3PBYwP09yMAPcZaH4IMAmKXMCcB0io2L0B8GLuHZRrJdzoh4Vv3rNRa2VtcfTtnq9nL+4OuGhhjeEWkGd+m+mBqXuFkHbhYrodcmyllALHRwBqx9/SPD3tc+8hbLvfIsW8yL3TcjANTv5qrnY/IyhSwrsCPRpwnZ/EPGHA3RtAFuAhf9xT200fWs8ER2NPdTFYdvbXrVkgzyHjLShNVTojxDrgDCZzb7SwYNRc/AeAjy8EAYGEgqmtpocF8BcFmKRYLP/0xwAAAABJRU5ErkJggg==

Hi @lewispeel,
for help with bootstrapping your application you should use SDK page. As for your question, currently Lightning does not support base64 encoded images but that's definitely something that should be considered for the future.
Best regards

hey @lewispeel, thanks for your questions / suggestions 👍

I understand Lightning uses Rollup, would it be possible to use https://github.com/rollup/plugins/tree/master/packages/image to do something like this?

Yeah, the Lightning-CLI bundles the App using Rollup. Currently we don't have anything in place to bundle images into that as well. I will checkout this plugin to know what it really does under the hood, and see if it's anything we can use in our config.
As a side note, in case you weren't aware: in your App you can reference the node_modules folder by using a ~, so you could do something like: import Lib from '~/package123/dist/lib.js (or import Icon from '~/package/assets/icon.png)

The images from the component library are being exported as Base64 encoded images, so I guess the question is, can Lightning handle an image src like...

It indeed won't work to just assign the src of an Image texture with a Base64 string. But it's definitely possible to use base64 images in Lightning. You could try something like this:
const base64Data =
 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAClUlEQVRYhe2YW47VMAyGf6c9zAtCggXAJuYFJNDsARYAi2UDbIB5RPA2EkIwnRhlektdO02alicsVc3Jxfn620l6iv9WaXS2gMxcNUc1YC3AlrkznR9hu56+QLVqdYsdJOBK67OsrRmcYVSrYtbgAtW2fhfNm9UxA86CIqWuGHBPiDXnGkAK0KpbWW0O5qq3W0GzoxJaTRFSypaaJZChjWEpuLHPWaFLqSYPhJwDgkzADShZ5zJUs/psWg6gpoyVa24j5Kk61fYoqAGQCJvbaEv5XVjJKs5Jfk1hWXaGP9UWgGJxpDZoTR0nlJNlDVLOtZpzbw5qjmUYLVjZ9/AclPUxgAYFBdBKj92AEA4tKAu4MRTchCxR0FoM8aRxaNsIjiNIZ+TgLgVLjy4n2sa7VDD20wzj2uHeRPdmAixcwaPJxRDXNyLUcd8nAF4DuAb4JUDPAFzND8LTuJSCluypE8NFcHHfSEH/DqD3gH8+RHoEcvM9XNSEptIczDlRrH3QAd1HADcI0SJi4AFDfnr0Jf8ISUT9M3VJBXPBLchlWP39JzjcTCN7yDvA3QL4DrhfIHRLEdqqN2pLOQXw91s4ipTzDLp8AZqv43vfiD2pmXofNIA0uNSYof3PBYwP09yMAPcZaH4IMAmKXMCcB0io2L0B8GLuHZRrJdzoh4Vv3rNRa2VtcfTtnq9nL+4OuGhhjeEWkGd+m+mBqXuFkHbhYrodcmyllALHRwBqx9/SPD3tc+8hbLvfIsW8yL3TcjANTv5qrnY/IyhSwrsCPRpwnZ/EPGHA3RtAFuAhf9xT200fWs8ER2NPdTFYdvbXrVkgzyHjLShNVTojxDrgDCZzb7SwYNRc/AeAjy8EAYGEgqmtpocF8BcFmKRYLP/0xwAAAABJRU5ErkJggg=='

    this.tag('MyImage').texture = Lightning.Tools.getCanvasTexture((cb, stage) => {
      const img = new Image()
      img.src = base64Data
      img.onload = () => {
        const canvas = stage.getDrawingCanvas()
        canvas.height = img.naturalHeight
        canvas.width = img.naturalWidth
        const ctx = canvas.getContext('2d')
        ctx.drawImage(img, 0, 0)
        cb(null, canvas)
      }
    })

I've put this on the bag log to add either to Lightning Core, or to make make this functionality available via a helper in the Lightning SDK.

Thanks Michiel,
I've create a pull request to allow the use of image imports via Lightning CLI - which should solve our problems; https://github.com/rdkcentral/Lightning-CLI/pull/80
If this is merged I can forget about using Base64 images for this usecase (although I guess that's still useful).
Thanks,
Lewis


[BUG] JSON imports fail at runtime with bundler

Bug Report Quick Checklist

[x] I am on the latest version of Snowpack & all plugins.
[x] I use package manager npm (Fill in: npm, yarn, pnpm, etc).
[x] I run Snowpack on OS Linux (Fill in: Windows, Mac, Linux, etc).
[x] I run Snowpack on Node.js v12+

Describe the bug

I have an import config from "./config.json" in one of my typescript files.
This builds fine, with no errors, however when the app is opened in the browser, I get an error in the console: Failed to load module script: The server responded with a non-JavaScript MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

To Reproduce

npx create-snowpack-app dir --template @snowpack/app-template-svelte-typescript
Create a .json file in src/ and import it from index.ts.
Set bundle: true in snowpack's optimize config
npm run build
Go in the build/ folder and start a webserver
Open the app in your browser
See error in the console!

Expected behavior
There should be no error. The .json file should import without problem, just like with bundle: false.
Anything else?
Looks like the issue is caused by bundle: true.

Looks like the same as #3109, try the workaround here.

I have the same issue. Fails to load logo.svg. When bundle: true


HTTP2/HTTP 1.1 metrics for IPA server

This change makes IPA web server to emit a metric that shows which HTTP protocol was used for every request made to the helper. The goal is to be aware if helpers start using HTTP 1.1. Restricting server code to accept HTTP 2.0 only is not great because HTTP 1.1 is way easier to debug and therefore valuable to support.
Alternatively we could just use a config that instructs the server which protocol it should exclusively support. Right now it feels that having this visibility is enough, but we may reconsider this in the future.
Note that it may be a bit misleading if connection starts as HTTP/1.1 and then gets upgraded to HTTP/2.0 but in our setting helper clients should probably initiate HTTP/2 from the beginning.

verified with CLI that metrics are indeed there
server:
cargo run --features self-signed-certs --bin helper -- -s http -p 3000

+---------------------------+-----------------------------------------------------+-------+------------+
| metric                    | description                                         | value | dimensions |
+======================================================================================================+
| request.protocol.HTTP/1.1 | Total number of HTTP/1.1 requests received          | 1     |            |
|---------------------------+-----------------------------------------------------+-------+------------|
| requests.received         | Total number of requests received by the web server | 2     |            |
|---------------------------+-----------------------------------------------------+-------+------------|
| request.protocol.HTTP/2.0 | Total number of HTTP/2 requests received            | 1     |            |
+---------------------------+-----------------------------------------------------+-------+------------+

client
curl "http://<IP_ADDRESS>:3000/echo?anotherfoo=anotherbar"                                                                                infra-send-buffers 3edb69e ✗
{"query_args":{"anotherfoo":"anotherbar"},"headers":{"host":"<IP_ADDRESS>:3000","accept":"*/*","user-agent":"curl/7.79.1"}}

curl "http://<IP_ADDRESS>:3000/echo?anotherfoo=anotherbar" --http2-prior-knowledge                                                                                infra-send-buffers 3edb69e ✗
{"query_args":{"anotherfoo":"anotherbar"},"headers":{"user-agent":"curl/7.79.1","accept":"*/*"}}


Update sql-database-elastic-query-getting-started.md

Changing author for Elastic Query articles to MlAndzic

@MladjoA,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@sign-off

@MladjoA : Thanks for your contribution to the Azure documentation! The author, @MladjoA, has been notified to review your proposed change.


quantum_info doc rendering bugs

Information

Qiskit Terra version:
Python version:
Operating system:

What is the current behavior?

(missing definition equation)

Steps to reproduce the problem
What is the expected behavior?
Suggested solutions
I just came across these by chance. Is there a linter or warnings from the doc build we can look at to find issues like these automatically?

Hi @kdk
I'm happy to look into this. Should be an easy fix if I can get some local format validation working.
And I'll see what I can find R.E. docstring linter or warning.

I believe I've fixed the formatting issues. However, I haven't been able to find a linter that is able to detect these small syntax issues in docstrings. If you have any suggestions please let me know.

I believe I've fixed the formatting issues. However, I haven't been able to find a linter that is able to detect these small syntax issues in docstrings. If you have any suggestions please let me know.

Awesome, feel free to open a PR. Automated detection can be left for another issue :) .

https://github.com/Qiskit/qiskit-terra/pull/5231


Support SVG width/height = auto

A major problem with SVGs is the width and height properties which have unfortunate consequences for layout because SVG 1.1 is not fully compatible with HTML in this respect.
Support for setting these to auto, an SVG 2.0 fix for this problem, is now in Firefox and will hopefully be in other browsers soon.
Please could SVG width/height being set to auto be added to the site.

+1

+1


Tasks / dataview support✨

I would very much like a dialog inside Day planner that allows to set up queries for Tasks and, if possible, also dataview.
The way I imagine this function is pretty straightforward:

I can define a time window that has a name, for example 6:30-7:15 workout
underneath this created time window, I can pick what tasks are to be filtered for it
the time window would then display the queried tasks in day planner timeline
the queried tasks can be ticked off directly inside day planner
time windows would also have a button to color them so I can easily see what windows I am in currently

This would make Day planner a complete timeblocking solution. Which would be AWESOME!!!

Day PLanner is .. just a note. with a template. You can add callouts right now, if you want to. I recommend being careful with indenting:
- [ ] 14:00 Do some GH things
    > [!todo] List of things for this block
    > query or embed or ..
    - Could also just list things.

Don't overthink things. This is just a note. Day Planner does no magic other than look for the Day Planner header, and timestamped tags underneath.
As it says in the readme, you're free to sprinkle in any other content you want in-between those lines. There is no great magic going on.


[Extension Bug] CoinMarketCap Crypto Crawler: Memory limit exceeded

Extension – CoinMarketCap Crypto Crawler
Author: @moojing
Description
Some queries return a lot of results, which lead to the extension running out of memory and crashing

Steps To Reproduce

Run Refresh Crypto List
Run Search Crypto command
Type a

The current behavior
Extension crashes.
The expected behavior
Extension doesn't crash. 😅 We could either limit the amount of results to e.g. 1000, or only perform searches when e.g. at least 3+ characters are provided.
Raycast version
Version: v1.27.1

Ohhhh, I didn't expect this situation. And I think limit the search result to a certain number is a good solution. Maybe a user don't need so many options when searching a token!
I can create another PR , maybe let's make the limit to be 1000 first?

@sxn  I updated the limit here (using 500 as the limit)


Document meson build

Partially done in #23

A question about this -include:
https://github.com/HaoZeke/OpenBLAS/blob/38365e5de310334fa53bfda4bfc68c23abd5fe62/interface/meson.build#L2
What compiler/platform was that for?

I don't recall the purpose of it. @HaoZeke do you remember?

Thanks, that is already helpful - I'll figure out what's different on my system then.

Okay, figured it out: that -include <file> check on my system isn't different on my system, it returns NO in CI jobs as well. Looks like you can't use that get_supported_arguments() check for more than a single flag, seems to fail due to argument quoting.


The border of calendar icon is not showing in dark mode, when the admin is trying to view booking in calendar view.

Bagisto Version: Master
Steps To reproduce--
1. Login as an admin with the dark mode.
2. Click on bookings inside the sales.
3. Try to view the booking in calendar-view.
Expected result: There should not be any UI issue on the bookings page.
Actual result: There is a UI issue on the calendar view of the bookings page. Please find the screen Here.

@jitendra-webkul
Now, this issue is fixed. so, I am closing this issue.
And I have attached a screenshot Here for future reference.


fixed smg collections within the transaction, added gharial decoding

WIP -

Tests missing.
Internal Ref:

https://github.com/arangodb/planning/issues/3815

https://github.com/arangodb/planning/issues/3815


Modify autoplay default by taking into account prefers-reduced-motion

This PR introduces a default value for the autoplay prop, by taking into account the prefers-reduced-motion media query.
If the host application doesn't specify @autoplay={{true}}, the component checks the user preference about motion, if no preference has been given, the component will autoplay the animation; otherwise, if the user prefers reduced motion, the animation won't play. It will follow a similar logic when @autoplay={{true}}.
When @autoplay={{false}}, the component will never play the animation automatically.
I'm also modifying the visibility of a few class methods/properties to improve the interface.
Details: https://web.dev/prefers-reduced-motion/

Can you test for a lottie animation playing? It'd be good to have a test for the default value and for how prefers-reduced-motion affects playback.

Can you test for a lottie animation playing? It'd be good to have a test for the default value and for how prefers-reduced-motion affects playback.

Let me try, I think I will need to write a mock and maybe refactor the code a little bit 👍

@mrloop I tried to test this as much as I could taking into account your suggestions, WDYT?


Every time I open the ranking tab I have to refresh page for it to display information.

Summary of Bug

Version

Steps to Reproduce

For Admin Use

[ ] Not duplicate issue
[ ] Appropriate labels applied
[ ] Appropriate contributors tagged
[ ] Contributor assigned/self-assigned

Sorry for the inconvenience. We found that people who connect to the API server in US zone may face this issue.
There's very heavy load on our server right now and we are considering to upgrade the server's spec.

No need to apologize, honest. This is the whole point of the test net. I am loving it so far. I am in Canada PST time and I am still at it trying to figure out ways to improve it but so far I am liking it. There is one thing thats been happening a lot; when I try to take advantage of a price distortion, as soon as I click the swap button and go to pay the gas fee, the price dramatically drops. Then I cancel it, it goes back to the previously distorted price. I lost so many tokens from this. I went from being in the top 1000 to the top 10000 due to this happening. Its awful lol
James Dennis
@.***

On May 6, 2021, at 3:02 AM, Hanjun Kim @.***> wrote:
Sorry for the inconvenience. We found that people who connect to the API server in US zone may face this issue.
There's very heavy load on our server right now and we are considering to upgrade the server's spec.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/tendermint/liquidity/issues/251#issuecomment-833401061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS5JCRFLZUZIPMIPR6AKKDLTMJSKXANCNFSM44GWYYSQ.


Undefined relationship after upgrade to statamic 3.3

When I'm visiting /api/collections/{collection}/entries I'm getting
"Call to undefined relationship [author] on model [Statamic\Eloquent\Entries\UuidEntryModel]"
after upgrade to statamic 3.3

After upgrading to Statamic 3.3 I'm experiencing the same where /entries is throwing a RelationNotFoundException, stack trace is here:
https://flareapp.io/share/o7AKb1bm#F68

Have you tried the new PR branch to see if that would help? https://github.com/statamic/eloquent-driver/pull/42

I tried the new PR but it still doesen't work for me. But i found the commit that is causing the problem.
https://github.com/statamic/cms/commit/ac70772990dccf560e10dcbdad6495dcc1518840#diff-919d52f8a749cfea24664e41c5b20b5a74117db74af777f9771f755b0b5fc0a5
In src/Http/Controllers/API/CollectionEntriesController.php
return app(EntryResource::class)::collection(
      $this->filterSortAndPaginate($collection->queryEntries()->with($with))
);

If i remove the "->with($with)" like below it works
return app(EntryResource::class)::collection(
      $this->filterSortAndPaginate($collection->queryEntries())
);

Hope that helps
//Thanks

I also tried the PR, did not resolve it.

@Micke-Nilsson how are you storing users (eloquent or flat file)? I've pushed up a commit here that should work if its eloquent: https://github.com/statamic/eloquent-driver/pull/42/commits/ffb59d4a3bf28102a238271ba3a9e869f70c62cd
Im not happy with it as a long term solution as it doesnt account for when users might be using flat files but it should get over your issue.

Thank you for your response.
I do store my users in eloquent so your workaround works for me.
Thanks

Now that v1 has been released I think you can close this issue?

v1 solves the problem with the author relationship.
But if you for example create a news collection and a category taxonomie and then add the category to the news blueprint
you will still encounter the same problem if you don't manually add the relationship to the Statamic\Eloquent\Entries\EntryModel

@Micke-Nilsson can you pull together a sample repository that shows the issue so I can work on a fix?

Of course I can do that tomorrow

@ryanmitchell I agree with @Micke-Nilsson it's also not resolved in my case, if you want I can give you access to my repo, please share your gitlab username

@djmenkveld sure, I just signed up, ryanmitchell1

@ryanmitchell I've just invited you, my setup is a bit different, but you'll figure it out to run it. So, I'm stuck at Statamic v3.3.11 and did not upgrade after. I can't completely recall what I did 1.5 years ago, but I'm also referring from a collection > fieldset > taxonomy > blueprint, since I did not want to repeat myself.

@djmenkveld I'm in the project but cant see any code - are you sure my permissions are correct? Can you also ensure the data is included? It would be useful to get clear steps to reproduce the issue to minimise the time to reproduction.

@ryanmitchell I've upgraded your role from guest to developer. Once running, you should create a test post and you'll able to reproduce it.

Yes i have created a repository with instructions to reproduce the error
https://github.com/Micke-Nilsson/statamic_issue

Wonderful, that was a great sample repository, thank you for the effort.
Fix here: https://github.com/statamic/eloquent-driver/pull/59

No problem, and thank you for your work

@Micke-Nilsson With help of @ryanmitchell I managed to resolve my issue, it works really good.

@ryanmitchell I have also verfied that it works, should i close this now?

No its ok, it will get closed when it merges.

Ok thanks a lot for the fix

Is this the same problem? https://flareapp.io/share/87nlJABm#F69
I got this after adding an entries fieldtype on a collection. Using the REST API to fetch entries from this collection, and the /api call returns this error.
Everything is very updated.

 Fixed manually for now, and awaiting the merge :)


replace the timeformatting stuff with shared function.

Coverage decreased (-0.0003%) to 92.782% when pulling 158cb6b18951b82df74e3961e91d1eb2ff95b11d on kmschoep-usgs:AQCU-984 into 3779853b5bf8767a30f282c3649e1d69301c68b3 on USGS-R:master.

Coverage decreased (-0.0003%) to 92.782% when pulling 4608af208890b5c4ef50a781eae4e6c536c2611b on kmschoep-usgs:AQCU-984 into 3779853b5bf8767a30f282c3649e1d69301c68b3 on USGS-R:master.


waitForElementToDisappear

Describe the feature you'd like:
I love the waitForElement function. However, there are cases where I don't add an element but rather remove existing ones. Is there a similar waitForElementToDisappear function or is there an easy way to achieve that using the existing functions?
Suggested implementation:
await waitForElementToDisappear(() => getByText('my button'))
...

Currently I'm using process.nextTick but that seems like a hack to me:
process.nextTick(() => {
    ...
    done()
})

Could you open this issue in dom-testing-library? That's where this work will be done. I'm thinking I'm in favor.


Release 0.10.0

Just merged high priority #1471

@Theodus i might be able to get to this tonight. you want to take it otherwise?

@SeanTAllen Sure, just tell me if you need me to do it.

If you can take it @Theodus that would be great. We are having a big push at work for a proof of concept and I'm tired as hell. Thanks.

@SeanTAllen sure thing!

The blessed commit will be df5b28f if Travis succeeds

Thanks @Theodus

Travis and AppVeyor builds have succeeded.

Merged, pushed, and tagged release branch.

Homebrew PR opened: https://github.com/Homebrew/homebrew-core/pull/7807

CHANGELOG added to release

@stefantalpalaru release is underway

@SeanTAllen We have a problem. AppVeyor has given the following message:
"BinTray" deployment has been skipped as environment variable has not matched ("llvm" is "3.7.1", should be "3.9.0")
"BinTray" deployment for branch "release" has been skipped because current branch is "master"

Gentoo ebuild updated.

Thanks @stefantalpalaru !

@Theodus thats a weird one.

@Theodus it doesn't look like the release is on the release branch

@Theodus i see a release-0.10.0 branch. Looks like you pushed to the wrong branch.
See:
https://github.com/ponylang/ponyc/commits/release

@Theodus as compared to:
https://github.com/ponylang/ponyc/commits/release-0.10.0

@Theodus and you put the 0.10.0 tag on master not on release.
I think we need to start over with a 0.10.1 tag.
Merge the prep release branch onto release.
Tag release.
And start the process after deleting the 0.10.0 release from releases.

I accidentally deleted my last comment. Arg.
So...
we need to
merge release-0.10.0 into release
tag as 0.10.1
push
update the homebrew PR
remove the 0.10.0 tag from master
delete the 0.10.0 release (see https://help.github.com/articles/editing-and-deleting-releases/)
have @stefantalpalaru update for 0.10.1
and then the usual process of waiting on travis and appveyor

I just cancelled the wrong travis build, it looks like you had already started.

@Theodus i deleted the 0.10.0 tag. I think we should do 0.10.1 to make sure there isn't detritus in Appveyor.

you are looking pretty good now @Theodus
you need to push the 0.10.1 tag on release.
update homebrew PR
and otherwise go through the normal process with release notes and everything else.

I just checked. 0.10.0 is in Bintray. I'm going to see about cleaning that up.

ok @Theodus 0.10.0 is deleted. if you want to restart with that tag, that could work as well.

Nevermind, I see 0.10.1 is pushed. that works and is safer. Anything else you need an assist with @Theodus or are you good?

@SeanTAllen I'm good, sorry about all that.

@Theodus It happens. just got to make sure to follow the checklist. I have plenty of checklists at work that I fubar from time to time.

@Theodus Can I delete the release-0.10.0 branch now?

@SeanTAllen yup

Homebrew PR updated

Gentoo ebuild updated again.

Thanks a million @stefantalpalaru

@Theodus did you update the VERSION number when you tagged? If not, we are going to have to start again with the correct version number.

Yeah. Its still 0.10.0.
Ok one more time!
I'll get this going...

Theodus, I just deleted 0.10.1
I'm going to go back to 0.10.0

@SeanTAllen Ok, thanks

I'll create a new PR for Homebrew

@Theodus ok you should be good to update Homebrew PR again
@stefantalpalaru sorry, you need to update again, I got 0.10.0 tag in the correct place. 0.10.1 no longer exists.

@Theodus it will go smoothly next time, i promise.

Homebrew PR updated and the tests have passed

Ugh... @Theodus

$ if [[ "$TRAVIS_REPO_SLUG" == "ponylang/ponyc" && "$LLVM_VERSION" == "3.9.0" && "$config" == "release" && "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then git remote add gh-token<EMAIL_ADDRESS>git fetch gh-token && git fetch gh-token gh-pages:gh-pages; build/release/ponyc packages/stdlib --docs; cd stdlib-docs; sudo -H pip install mkdocs; cp ../.docs/extra.js docs/; sed -i '' 's/site_name:\ stdlib/site_name:\ Pony Standard Library/' mkdocs.yml; mkdocs gh-deploy -v --clean --remote-name gh-token; fi;

Skipping a deployment with the bintray provider because this branch is not permitted
Skipping a deployment with the bintray provider because a custom condition was not met
Skipping a deployment with the bintray provider because this branch is not permitted
Skipping a deployment with the bintray provider because a custom condition was not met
Skipping a deployment with the bintray provider because this branch is not permitted
Skipping a deployment with the bintray provider because a custom condition was not met
Skipping a deployment with the bintray provider because a custom condition was not met
Skipping a deployment with the bintray provider because a custom condition was not met
Skipping a deployment with the bintray provider because a custom condition was not met

It looks like Travis is done and 0.10.0 for Linux should be in Bintray, but I don't see it yet.

I see all 3 in bintray

Ya its good I was looking under master because I'm very tired.

Alrighty just waiting on Bintray.

Theodus, did you go through open PRs and any that have manual CHANGELOG entry, let them know they'll need to update due to release?

I have

Sweet

What's the Homebrew PR link @Theodus?

https://github.com/Homebrew/homebrew-core/pull/7807

Bintray releases are ready, just waiting on Homebrew.

Homebrew updated

IRC and user group have been notified. @stefantalpalaru has the Gentoo build been changed back to 0.10.0?

I've reverted the Gentoo ebuild to 0.10.0.


Short solution needed: "chrome headless resolution" (chrome-headless)

Please help us write most modern and shortest code solution for this issue:
chrome headless resolution (technology: chrome-headless)
Fast way
Just write the code solution in the comments.
Prefered way

Create pull request with a new code file inside inbox folder.
Don't forget to use comments explain solution.
Link to this issue in comments of pull request.

How to take page screenshot in specific resolution


'Auto' will need to be 'Automatic' for a Windows 7 VM.

[Enter feedback here]

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 1b9c0d7a-bbf5-eccc-f2ca-a825bf42c82f
Version Independent ID: 58aa93af-4030-1541-a14c-c66c683ccf7c
Content: Prepare a Windows VHD to upload to Azure
Content Source: articles/virtual-machines/windows/prepare-for-upload-vhd-image.md
Service: virtual-machines-windows
GitHub Login: @glimoli
Microsoft Alias: genli

Thanks for the feedback! We are currently investigating and will update you shortly.

@mnp3 thanks for pointing this out.
As the article states this doc is not specifically written for Windows 7

I will close this as there is no action on the doc. I appreciate you bringing this up however.

@MicahMcKittrick-MSFT there was a typo on the article which I've fixed already.


Configure typescript

Deploy preview for codeglide failed.
Built with commit 683ba8c6af0a68405e643d770fb1e77811bcc560
https://app.netlify.com/sites/codeglide/deploys/5bb8dbb1c965920d137453b7


Attempt fixing flakiness of check config test

Description:
Attempt address some flakiness for check config script tests

Merging it and hope that it makes a difference. The flakiness is horrible.

setLevel will defnitely be an improvement over the 6 statements in SILENCE!
Just for my clarity, mock_coro is only really needed for async_enable_logging?
Still want to work on this to reduce mocks, my current plan was:

Mock based loading of the yaml config (I see no other way to do and drill down into details of files/secrets)
Instead of using bootstrap, write something to do the voluptuous checks

If you have other ideas, I'll move thi to the architecture forum

I think that if you go for 2 we don't need any of the mocks. Just a simple config loader. We can even break out some of the parts in Home Assistant to make them more easily usable inside the check config script.

mock_coro is indeed only necessary for any coroutine that is mocked but it doesn't hurt for the others


Data augmentation parameters: enable_mosaic & enable_mixup

I turned off enable_mosaic & enable_mixup:
enable_mixup     │ False
enable_mosaic    │ False
but when I saved the images after augmentation, I noticed that the system is still doing mixup & mosaic augmentation.

I tested it again with the latest updated code. the bug is still there.

Is this issue resolved yet?


Add data to event

Is it possible to add data to each event? If not, are you planning a similar feature?
I'm doing a chat analyzer and I would like to add the content of the message to the event to display it on hover.
Regards

As long as you can map your additional data to the event (the date) you can display any info you want on eventHover. since you have access to the date here, via the element.
simply use:
d3.select(el).data()[0];

to get the date of the event.

But there's no way of knowing in which eventLine the event is located right?

To get the name of the event lines do:
d3.select(el.parentNode).data()[0].name

The parent element of the event element, being the line, d3 can acces the data binded to it. This include its name.


View graph link should open in new tab

Now you navigate away from the current page...

Fixed on beta and production.


[MTSRE-376] Replace the old extractor.

Also an important change is that we are going to be passing bundle using pointers as they are expensive to copy, and we only need read-access. Bundles are meant to be immutable.

Can't merge before we fix non-OPM compliance: https://issues.redhat.com/browse/MTSRE-382 ... :(

Closing in favor of #113


Omega builds illegal proof term containing pos_pow_of_pos

Prerequisites
Please put an X between the brackets as you perform the following steps:

[x] Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues
[x] Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries.
[x] Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)

Description
Consider the MWE (lean playground link here):
/-
application type mismatch
  Int.pos_pow_of_pos
argument has type
  Int
but function has type
  ∀ {n : Nat} (m : Nat), 0 < n → 0 < n ^ m
-/
theorem omega_fail
  (n : Nat)
  (i : Int)
  (h2n : (2 : Int) ^ n = ↑((2 : Nat) ^ (n : Nat)))
  (hlt : i % 2 ^ n < 2 ^ n) :  2 ^ n ≠ 0 :=
  by omega /- No goals -/

Omega builds an incorrect proof term for this goal state.
Context
Occurred when proving bitblasting theorems.
Steps to Reproduce
Expected behavior: Omega should succeed without an illegal proof.
Actual behavior: Omega builds an illegal proof term.
Versions
Live lean version: "4.9.0-nightly-2024-05-11"

Additional Information
[Additional information, configuration or data that might be necessary to reproduce the issue]
Impact
Add :+1: to issues you consider important. If others are impacted by this issue, please ask them to add :+1: to it.

Thanks! Fixed in #4141.


Select broken in 6.0.0b2

Not sure if you guys are already aware of bugginess in Select in the beta releases, but I tried upgrading and noticed Selects weren't working so thought I'd submit this.  Setting value on a Select seems to be broken in 6.0.0b1 and b2.
import ipywidgets
from IPython.display import display
select = ipywidgets.Select(
     options={'ok': 'ok', 'yes': 'yes', 'maybe': 'maybe', 'whatevs': 'whatevs'},
     width='100px',
     height='20px'
)
select.value = 'ok'
display(select)

The select shows up as blank (None selected) regardless of what I do programmatically.  Also, observing value does not call the given function when manually changing the selected option.

Thanks for lettings us know. I've confirmed the issue. Investigating...

It looks like this commit didn't fix all the places where selected_label was used: https://github.com/ipython/ipywidgets/commit/aef3069a3b965bd675d983fa3952aec2c2067620

Looks like it might have @afshin's commit: https://github.com/ipython/ipywidgets/commit/5b47aaac9285ec961e43525cc1dea2e9047b7edd#diff-61326cb05eb256df11c903abf2527196R605 - that's where it is switched from using the model's value attribute to a selected_label attribute, though it doesn't appear that such an attribute exists on the model.

Of course, we should have caught that on review of @afshin's PR too.

D'oh! I missed that; mea culpa.
:sweat_smile:

@afshin actually, the change from selected_item to value happened around the same time as your PR, so it is almost certainly a rebase thing :)


Compiler fails to infer type in overloaded functions

TypeScript Version:  3.6.3
Search Terms: overload overloaded infer type flow
Code
function foo(): void
function foo(a: string, b: string): void
function foo(a?: string, b?: string): void {
    if (!a) return
    console.log(a.length + b.length)
}

Expected behavior:
The code compiles (the compiler deduces b != null from the set of possible overloads)
Actual behavior:
bug.ts:5:28 - error TS2532: Object is possibly 'undefined'.

Often times, if you're not dealing with generic functions, I find that you're better off using rest args on tuple types.
function foo(...args : []|[number, number]): void {
    if (args.length == 0) return;
    const [a, b] = args;
    console.log(a.length + b.length);
}

foo(); //OK
foo(1,2); //OK
foo(1); //Error

I'm on mobile now, so I might have made a mistake but the above should work

Another example I posted on Gitter earlier on,
interface Data {
    someUsefulPieceOfInfo : string
}
function callback (...args : [Error]|[null|undefined, Data]) {
    if (args[0] == undefined) {
        console.log(args[1].someUsefulPieceOfInfo);
    } else {
        console.error(args[0].message);
    }
}

callback(new Error("blah"));
callback(undefined, { someUsefulPieceOfInfo : "Hello, world" });

Playground

@AnyhowStep in response to https://github.com/microsoft/TypeScript/issues/33704#issuecomment-537123335
Is there any workaround for when you are using generics?
export function anyLoading<TData1>(
  responses: [Response<TData1>]
): responses is [ResponseSuccessful<TData1>];
export function anyLoading<TData1, TData2>(
  responses: [Response<TData1>, Response<TData2>]
): responses is [ResponseSuccessful<TData1>, ResponseSuccessful<TData2>];
export function anyLoading(responses: Response<any>[]) {
  return !responses.some(isLoading);
}

I'd like be able to define my overloads like above and be able to call anyLoading with a parameter of type [Response<TData1>] | [ResponseSuccessful<TData1>, ResponseSuccessful<TData2>]

Seems like the same pattern as Promise.all()


chore(npm): remove lockfile

This removes our lockfile and our ci-or-install script. The lockfile
caused headaches, since npm install would modify the lockfile.
Unfortunately, ci-or-install (added in #896) didn't work reliably on
appveyor, so removing the lockfile seems easier. We remove the script
since it's now obsolete.
Fixes #893

Codecov Report

Merging #911 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #911   +/-   ##
=======================================
  Coverage   97.32%   97.32%
=======================================
  Files          34       34
  Lines        1271     1271
=======================================
  Hits         1237     1237
  Misses         34       34

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 26d6e0e...f3ec88e. Read the comment docs.