Skip to content

Commit

Permalink
Changes from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahbenizzy committed Mar 6, 2024
1 parent a59ed45 commit 4455cf2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
18 changes: 11 additions & 7 deletions docs/concepts/additional-visibility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ For the function-based API, this would look as follows:
from burr.visibility import TracingFactory
from burr.core import action
@action(reads=['input_var'], writes=['output_var'], __tracer: TracingFactory)
def my_action(state: State) -> Tuple[dict, State]:
@action(reads=['input_var'], writes=['output_var'])
def my_action(state: State, __tracer: TracingFactory) -> Tuple[dict, State]:
with __tracer('process_data'):
initial_data = _process_data(state['input_var'])
with __tracer('validate_data'):
Expand Down Expand Up @@ -68,19 +68,23 @@ For instance:

.. code-block:: python
from burr.visibility import TracingFactory
from burr.visibility import TracingFactory, ArtifactLogger
from burr.core import action
@action(reads=['input_var'], writes=['output_var'], __tracer: TracingFactory)
def my_action(state: State) -> Tuple[dict, State]:
@action(reads=['input_var'], writes=['output_var'])
def my_action(
state: State,
__tracer: TracingFactory,
__logger: ArtifactLogger
) -> Tuple[dict, State]:
with __tracer('process_data'):
initial_data = _process_data(state['input_var'])
with __tracer('validate_data'):
validation_results = _validate(initial_data)
t.log_artifact(validation_results=validation_results)
with __tracer('transform_data', dependencies=['process_data']) as t:
with __tracer('transform_data', dependencies=['process_data'])
transformed_data = _transform(initial_data)
t.log_artifact(transformed_data_size=len(transformed_data))
__logger.log_artifact(transformed_data_size=len(transformed_data))
return {'output_var': transformed_data}, state.update({'output_var': transformed_data})
Expand Down
9 changes: 8 additions & 1 deletion telemetry/ui/src/components/common/href.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
*/
export const LinkText = (props: { href: string; text: string }) => {
return (
<a href={props.href} className="text-dwlightblue hover:underline">
<a
href={props.href}
className="text-dwlightblue hover:underline"
onClick={(e) => {
// Quick trick to ensure that this takes priority and if this has a parent href, it doesn't trigger
e.stopPropagation();
}}
>
{props.text}
</a>
);
Expand Down
4 changes: 3 additions & 1 deletion telemetry/ui/src/components/routes/ProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { DateDisplay } from '../common/dates';
import { Button } from '../common/button';
import { Chip } from '../common/chip';
import { LinkText } from '../common/href';
import { useNavigate } from 'react-router-dom';

/**
* Table of a project list. Uses the tailwind catalyst component.
* This does not load or fetch any data, just renders it
*/
export const ProjectListTable = (props: { projects: Project[] }) => {
const navigate = useNavigate();
const projectsCopy = [...props.projects];
const projectsSorted = projectsCopy.sort((a, b) => {
return a.last_written > b.last_written ? -1 : 1;
Expand Down Expand Up @@ -44,7 +46,7 @@ export const ProjectListTable = (props: { projects: Project[] }) => {
<TableRow
key={project.id}
className="hover:bg-gray-50 cursor-pointer"
href={`/project/${project.id}`}
onClick={() => navigate(`/project/${project.id}`)}
>
<TableCell className="font-semibold text-gray-700">
<div className="flex flex-row gap-2">
Expand Down

0 comments on commit 4455cf2

Please sign in to comment.